Telegram Web Link
Code snippet:
String s1 = "Java";
String s2 = "Java";
StringBuilder sb1 = new StringBuilder();
sb1.append("Ja").append("va");
System.out.println(s1 == s2);
System.out.println(s1.equals(s2));
System.out.println(sb1.toString() == s1);
System.out.println(sb1.toString().equals(s1));
Code snippet:
1: public class _C {
2: private static int $;
3: public static void main(String[] main) {
4: String a_b;
5: System.out.print($);
6: System.out.print(a_b);
7: } }
Code snippet:
// Line n1
switch (cardVal) {
case 4: case 5: case 6:
case 7: case 8:
System.out.println("Hit");
break;
case 9: case 10: case 11:
System.out.println("Two");
break;
case 15: case 16:
System.out.println("Sur");
break;
default:
System.out.println("Win");
}
This media is not supported in your browser
VIEW IN TELEGRAM
Code snippet:
1: public class FeedingSchedule {
2: public static void main(String[] args) {
3: boolean keepGoing = true;
4: int count = 0;
5: int x = 3;
6: while(count++ < 3) {
7: int y = (1 + 2 * count) % 3;
8: switch(y) {
9: default:
10: case 0: x -= 1; break;
11: case 1: x += 5;
12: }
13: }
14: System.out.println(x);
15: } }
Code snippet:
13: System.out.print("a");
14: try {
15: System.out.print("b");
16: throw new IllegalArgumentException();
17: } catch (RuntimeException e) {
18: System.out.print("c");
19: } finally {
20: System.out.print("d");
21: }
22: System.out.print("e");
What is the result of the following program?

1: public class MathFunctions {
2: public static void addToInt(int x, int amountToAdd) {
3: x = x + amountToAdd;
4: }
5: public static void main(String[] args) {
6: int a = 15;
7: int b = 10;
8: MathFunctions.addToInt(a, b);
9: System.out.println(a); } }|
What is the result of the following code?

int[] array = {6,9,8};
List<Integer> list = new ArrayList<>();
list.add(array[0]);
list.add(array[2]);
list.set(1, array[1]);
list.remove(0);
System.out.println(list);
What is the output of the following code?

public class Deer {
public Deer() { System.out.print("Deer"); }
public Deer(int age) { System.out.print("DeerAge"); }
private boolean hasHorns() { return false; }
public static void main(String[] args) {
Deer deer = new Reindeer(5);
System.out.println(","+deer.hasHorns());
}
}
class Reindeer extends Deer {
public Reindeer(int age) { System.out.print("Reindeer"); }
public boolean hasHorns() { return true; }
}
What is the output of the following program?

public class BearOrShark {
public static void main(String[] args) {
int luck = 10;
if((luck>10 ? luck++: --luck)<10) {
System.out.print("Bear");
} if(luck<10) System.out.print("Shark");
} }
2025/07/06 02:33:35
Back to Top
HTML Embed Code: