A

Admin • 828.03K Points
Coach

Q. What will be the output?
public class Test{
public static void main(String args[]){
Object myObj = new String[]{"one", "two", "three"};
{
for(String s : (String[])myObj)
System.out.print(s + ".");
}
}
}

  • (A) one.two.three.
  • (B) Compilation fails because of an error at line 3
  • (C) Compilation fails because of an error at line 5
  • (D) Compilation fails because of an error at line 5 D. An exception is thrown at runtime.
  • Correct Answer - Option(A)
  • Views: 14
  • Filed under category Java
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.