Q:

What is the compile-time error in this program?

belongs to collection: Java exercises

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)

Explain the difference between using a computer pr... >>