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 class A {
2 double a;
3 double b;
4 A (int digit) {
5 ...
6 b = 2 * digit / a;
7}
8 ...
class abc.Point {
abc.Point (int a, int b) {
x = a;
y = b;
}
int x, y;
...
}
Вкажіть результат виконання наступного фрагмента коду:
abc.Point p = new abc.Point (5,3), p1;
p1 = p;
p = null;
System.out.println (px);
(Java)
модифікувати в вашій програмі, щоб отримати правильний результат.
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)
class Parent {
public void print () {
System.out.println (x);
}
}
class Child extends Parent {
int x = 3;
public static void main (String [] args) {
Parent c = new Child ();
c.print ();
}
}
(Java)
public class SomeClass {
public static void main (String [] args) {
SomeClass t = new SomeClass ();
t.say (3);
}
private void say (int digit) {
switch (digit) {
case 1:
System.out.print ( "ONE");
break;
case 2:
System.out.print ( "TWO");
case 3:
System.out.print ( "THREE");
default:
System.out.print ( "Unknown");
}
}
}
(Java)
public class SomeClass {
static int x = 5;
public static void main (String [] args) {
int x;
int y = 5;
if (y> 3) x = 1;
System.out.println (x);
}
}
(Java)
long a = 111111111111L;
double f = a;
long b = 11111L;
double d = b;
System.out.println (a = = (long) f);
System.out.println (b = = (long) d);
(Java)
long a = 111111111111L;
float f = a;
long b = 11111L;
float d = b;
System.out.println (a = = (long) f);
System.out.println (b = = (long) d);
(Java)
public class SomeClass {
public static void main (String [] args) {
SomeClass t = new SomeClass ();
____
}
private int check (String x, int n) {
if (n = = 0) return n;
else if (n = = 1) {
if (x! = null) return 5;
} Else if (n = = 2 && x! = Null) {
if (x.equals ( "YES")) return 3;
else if (x.equals ( "NO")) return 4;
}
return -1;
}
}
Якщо замість знаків підкреслення помістити код виклику методу check, то яка з пропозицій буде вірним?
(Java)