Q:

What is the compile-time error in this program?

0

What is the compile-time error in this program?

public class Test
{
 public static void main(String[] args)
 {
 System.out.println("Hello", "World!");
 }
}

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Java interprets the comma in the println method to mean that two strings are passed to println. It's likely the programmer meant to do this:
System.out.print("Hello, World!");

the true solve:

public class Test
{
 public static void main(String[] args)
 {
 System.out.println("Hello", "World!");
 }
}

 

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now