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!
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 ...
(Java)
abstract class A {
abstract void method (int a, int b);
}
class B extends A {
int x;
int y;
void method (int a, int b) {
x = a;
y = b;
}
}
Які нижчеперелічені фрагменти коду неприпустимі?
public class SomeClass {
public static void main (String [] args) {
SomeClass c = new SomeClass ();
c.f1 (1, 1);
}
public void f1 (byte b, char c) {
System.out.println ( "1");
}
public void f1 (byte b, byte c) {
System.out.println ( "2");
}
public void f1 (char b, char c) {
System.out.println ( "3");
}
public void f1 (char b, byte c) {
System.out.println ( "4");
}
}
(Java)
class abcPoint {
abcPoint (int a, int b) {
x = a;
y = b;
}
int x, y;
...
}
Вкажіть результат виконання наступного фрагмента коду:
abcPoint p = new abcPoint (5,3), p1 = p;
px = 4;
System.out.println (p1.x);
(Java)
import java.awt.Point;
public class Obscuring {
static Point Test = new Point (3,2);
public static void main (String s []) {
System.out.println (Test.x);
}
}
class Test {
static int x = -5;
}
(Java)
2 ...
3 double m;
4 double s () {
5 return g * this.m;
6}
7}
1 public class SomeClass {
2 public static void main (String [] args) {
3 String [] arr = { "H", "e", "l", "l", "o", "", "W", "o", "r", "l", "d", "!" };
4 String result = "";
5 int i = 0;
6 ...
7 System.out.print (arr [i]);
8 }
9 }
(Java)
Wolf w = new Wolf ();
Animal a = (Animal) w;
Rabbit r = (Rabbit) a;
(Java)