Posts of Java | Tests
public class Test { public static void main(String[] args) { int i = 5; boolean b = bool(i++ * 2) && bool(i); } public static boolean bool(int i) { System.out.print(i); return true; } }
Open in Telegrampublic class Test { public static void main(String[] args) { System.out.println(10 + 20 + "30"); } }
Open in Telegram🧠 Прокачай мозг с NonoQuest! 🧩 Хочешь не просто убивать время, а тренировать мышление? Попробуй NonoQuest — увлекательные японские кроссворды (нонограммы), где логика превращается в яркие пиксельные картинки! 🎨 ✨ Тренируй логику и внимание 🔍 Развивай концентрацию 💡 Поддерживай умственную активность Регулярные интеллектуальные занятия полезны для когнитивного здоровья. 🎮 NonoQuest — устрой мозгу полезную разминку! 📱 Игра для Android. Попробуй разгадать свою первую головоломку!
Open in Telegramimport java.util.HashSet; import java.util.Set; public class Test { public static void main(String[] args) { String str1 = "Hello World"; String str2 = new String("Hello World"); Set<String> set = new HashSet<>(); set.add(str1); set.add(str2); for (String str : set) { if (str == str1) { System.out.print("origin "); } if (str == str2) { System.out.print("replace "); } } } }
Open in Telegrampublic class Test { public static void main(String[] args) { int i=0; label1: System.out.print(i++); if (i < 2) { goto label1; } } }
Open in Telegrampublic class Test { public static void main(String[] args) { System.out.print(condition1() && condition2()); } private static boolean condition1() { System.out.print(1); return false; } private static boolean condition2() { System.out.print(2); return true; } }
Open in Telegramclass A { static class B { static String C = "NOT TO BE"; } static Z B = new Z(); } class Z { String C = "TO BE"; } public class Test { public static void main(String[] args) { System.out.println(A.B.C); } }
Open in Telegramclass Dog { public static void bark() { System.out.print("Woof "); } } class Basenji extends Dog { public static void bark() { } } public class Bark { public static void main(String[] args) { Dog woofer = new Dog(); Dog nipper = new Basenji(); woofer.bark(); nipper.bark(); } }
Open in Telegrampublic class Test { { System.out.println(i); } int i; public Test(int i){ this.i = i; } public static void main(String[] args) { new Test(1); } }
Open in Telegrampublic class Test { public static void main(String[] args) { System.out.println(condition(null) ? 1 : 2); } public static boolean condition(Number o) { return true; } public static boolean condition(Long l) { return false; } }
Open in Telegram