Java Code Examples
Java Code Examples
class main {
public static void main(String args[]) {
Bank obj = new Bank();
WithdrawThread t1 = new WithdrawThread(obj);
DepositThread t2 = new DepositThread(obj);
t1.start();
t2.start();
}
Java Code Examples
class test {
public static void main(String arg[]) throws IOException {
File f = new File("this.txt");
Scanner sc = new Scanner(f);
while (sc.hasNextLine()) {
String s = sc.nextLine();
System.out.println(s);
}
sc.close();
}
}
class test {
public static void main(String arg[]) throws IOException {
Scanner sc = new Scanner(System.in);
FileWriter f = new FileWriter("this.txt");
while (true) {
String s = sc.next();
if (s.equalsIgnoreCase("exit")) {
break;
}
f.write(s + "\n");
}
f.close();
}
}
if (b == 0) {
throw new myexception("Are bhai ye kya kar raha hai, 0 se koi chiz kaise divide
hogi?");
}
System.out.println(a / b);
} catch (myexception e) {
System.out.println(e.getMessage());
}
}
}
demo() {
jb1 = new JButton("Concatenate");
jl1 = new JLabel("Enter first name");
jl2 = new JLabel("Enter second name");
jl3 = new JLabel("Result");
jf1 = new JTextField(20);
jf2 = new JTextField(20);
jf3 = new JTextField(20);
setLayout(new FlowLayout());
add(jl1);
add(jf1);
add(jl2);
add(jf2);
add(jl3);
add(jf3);
add(jb1);
jb1.addActionListener(new xy());
}