What will be the output of the following Java program?
class string_class
{
public static void main(String args[])
{
String obj = “hello”;
String obj1 = “world”;
String obj2 = obj;
obj2 = ” world”;
System.out.println(obj + ” ” + obj2);
}
}
a) hello hello
b) world world
c) hello world
d) world hello
Answer: c
Related Posts
What happens in the following javaScript code snippet?
var count = 0;
while (count < 10)
{
console.log(count);
count++;
}In the following switch syntax, the expression is compared with the case labels using which of the following operator(s)?
switch(expression)
{
statements
}The “var” and “function” are __________
When an empty statement is encountered, a JavaScript interpreter __________
What is a block statement in JavaScript?
Which is a more efficient JavaScript code snippet?
Code 1 :
for(var num=10;num>=1;num–)
{
document.writeln(num);
}
Code 2 :
var num=10;
while(num>=1)
{
document.writeln(num);
num++;
}A conditional expression is also called a _______________
Join The Discussion