Тесты
Язык сайта: Русский
Українська
English
Русский
Тесты по программированию
Вход
Регистрация
Тесты по программированию
Теория
сниппеты
Статьи
Главная
Android
Цены
FAQ
История Cosmo
Правила и условия сервиса
Политика конфиденциальности
Политика в отношении файлов cookie
Обратная Связь
strings
:
Язык контента: English
Русский
What will be the result of compiling and running this code? public class Sentence { public static void main(String[] args) { String str1 = "Zero"; String str2 = "Zero"; boolean b1; if (str1 == str2) b1 = true; else b1 = false; System.out.println(b1); String str3 = "Zero"; String str4 = "Zero1"; boolean b2; if (str3 == str4) b2 = true; else b2 = false; System.out.println(b2); } }
strings
What will be the result of compiling and running the following program? public class App1 { public static void main(String[] args) { System.out.println(addToString("12345678910",',')); } public static StringBuffer addToString(String s, char c) { StringBuffer b = new StringBuffer(s); int p = 0; for (int i = 1; i < b.length(); i++) { if (i%3 == 0) { b.insert(b.length()-i-p, c); p++; } } return b; } }
strings
Select one right option of compiling and running this code. public class Strings { public static void main(String[] args) { String s1 = new String("Bicycle"); String s2 = new String("bicycle"); System.out.println(s1.equals(s2) == s2.equals(s1)); } }
strings
What is the result of compiling and running the following code? class Base { public String name = "Base"; public String getName() { return name; } } class Sub extends Base { public String name = "Sub"; public String getName() { return name; } } public class Program { public static void main(String[] args) { Sub s = new Sub(); Base b = s; System.out.println(b.name); } }
strings
What will be displayed as a result of the following code compilation and execution? String x = "Java"; x.concat(" Rules!"); System.out.println("x = " + x); x.toUpperCase(); System.out.println("x = " + x); x.replace('a', 'X'); System.out.println("x = " + x);
strings
What is the result of the following code execution? Boolean b = new Boolean("Hello"); System.out.println(b);
strings
Which of the following statements are true given the following code: String a = new String("hello"); String b = new String(a); String c = a; char[] d = { 'h', 'e', 'l', 'l', 'o' };
strings
What will be the result of the following code execution? public class PrintTest { public static void main(String[] args) { System.out.println("1" + 2 + 3); } }
strings
Given a string: String s = "true,false"; How can a new string, which is equal to "test", be formed?
strings
What will be the output of the program import java.util.Formatter; public class Formatting { public static void main(String[] args) { Formatter formatter = new Formatter(); System.out.println( formatter.format("%b %b %b %b %b", true, null, "false", new Boolean("false"), 0) ); } }
strings
← Предыдущая
1
2
3
4
5
Следующая →
Зарегистрируйся сейчас
или
Подпишись на будущие тесты