Looking for Програмування мовою Java test answers and solutions? Browse our comprehensive collection of verified answers for Програмування мовою Java at moodle.chnu.edu.ua.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
int i = 0;
while (i <4) {
System.out.print (i);
if (i> = 2)
try {
throw new ArithmeticException ( "ex");
}
catch (ArithmeticException e) {
System.out.print (i);
break;
}
i ++;
}
(Java)
(Java)
Object
java.lang
lang
java.lang.Object
(Java)
1 class A {
2 final int a = 5;
3 protected double c;
4 protected int q;
5 private int j;
6}
7 class B extends A {
8 int c;
9 B (int b1, int b2) {
10 super ();
11 c = b1;
12}
13}
public abstract class SomeClass implements Runnable {
private Object lock = new Object ();
public void lock () {
synchronized (lock) {
try {
System.out.print ( "1");
lock.wait ();
} Catch (InterruptedException e) { }
}
}
public void unlock () {
synchronized (lock) {
lock.notify ();
System.out.print ( "2");
}
}
public static void main (String s []) {
new Thread (new SomeClass () {
public void run () {
lock ();
}
}). Start ();
new Thread (new SomeClass () {
public void run () {
unlock ();
}
}). Start ();
}
}
(Java)
1 package newpack;
2 class A {
3 int a, b;
4 void sum () {
5 System.out.print (a + b);
6}
7}
8 class B extends A {
9 ...
10}
11 ...