Write a applet program that simulates a digital clock.
Output:
Output:
//Program for implementing Traffic Signals import java.applet.*; import java.awt.*; import java.awt.event.*; /*<applet code=”Signals” width=400 height=250></applet>*/ public class Signals extends Applet implements ItemListener { String msg=””; Checkbox stop,ready,go; CheckboxGroup cbg; public void init() { cbg…
Java Design Patterns | Consumer and Producer Pic credit: Freepic.com // implementation of a producer and consumer. class Q { int n; boolean valueSet = false; synchronized int get() { while(!valueSet) try {…
Java Custom Exceptions Program to create a user defined exception class Myexception extends Exception { int detail; Myexception(int a) { detail=a; } public String toString() { return “Myexception[“+detail+”]”; } } class…
//Program to throw implement division and throw exceptions import java.util.*; class NAexception { public static void main(String args[]) { Scanner scr=new Scanner(System.in); int num1,num2,q; try { System.out.println(“nEnter the value of first integer :…
package pack1; public class Student { public int rol_no=18; public char name[]={‘s’,’e’,’k’,’h’,’a’,’r’}; } package pack2; public interface Sports { void show(); } //Program to implement packages package Record; import pack1.*; import pack2.*;…
//Evaluating the postfix expression import java.util.*; class postfix1 { double a[]=new double[20]; int top; postfix1() { top=-1; } void push(double x) { top++; a[top]=x; } double pop() {…
//Program for infix to postfix conversion import java.util.*; class itop1 { char s[]=new char[10]; int top; itop1() {top=-1; } void i2post(char in[]) { int i,j=0; char post[]=new char[20]; char ichar,schar; …
//Program to implement Stacks import java.util.*; import java.io.*; class Stack1 { int t; int a[]=new int[5]; Stack1() { t=-1; } boolean isempty() { return (t==-1); } boolean isfull() …
//Program to implement Stacks import java.util.*; import java.io.*; class Stack1 { int t; int a[]=new int[5]; Stack1() { t=-1; } boolean isempty() { return (t==-1); } boolean isfull() …