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!
(Java)
(Java)
1 class A {
2 public char ch = 'a';
3 protected short charCode;
4 protected short charCodeFin;
5 private int j;
6 int d;
7}
int a = 42, i = 0;
while (i <3) {
try {
System.out.print (42 / a);
}
catch (ArithmeticException e) {
System.out.print (42/2);
}
finally {
System.out.print (42/1);
}
a - = 7;
i ++;
}
public abstract class SomeClass implements Runnable {
public Object lock = new Object ();
public void lock () {
synchronized (lock) {
try {
lock.wait ();
System.out.print ( "1");
} Catch (InterruptedException e) { }
}
}
public void notifyThread () {
synchronized (lock) {
lock.notify ();
}
}
public void unlock () {
synchronized (lock) {
lock.notify ();
System.out.print ( "2");
}
}
public static void main (String s []) {
final SomeClass c = new SomeClass () {
public void run () {
lock ();
}
};
final SomeClass c1 = new SomeClass () {
public void run () {
unlock ();
c.notifyThread ();
}
};
new Thread (c) .start ();
new Thread (c1) .start ();
}
}
(Java)
public class SomeClass {
public static void main (String args []) {
SomeClass s = new SomeClass ();
System.out.println (sx + "," + sy);
}
int getX () {
return x;
}
int y = getX ();
int x = 3;
}
(Java)
public class SomeClass {
public static void main (String [] args) {
int a [] = {1, 2, 3 };
int b [] = (int []) a.clone ();
a [0] = 0;
System.out.print (b [0]);
System.out.print (b [1]);
System.out.print (b [2]);
}
}
(Java)
наступних полів потрібно оголосити динамічними?
(Java)
(Java)