0
System.out.print("hello"); not work
Its not work in jaava
3 Respuestas
+ 4
In a Java program, a single line like this doesn't work.
Instructions have to be placed inside a function / main function, and main function has to be placed inside a Class.
Continue the introduction course, and you will find out how a simple "Hello World!" program is created.
+ 3
You can post your code here like the following guide and we can identify what you've done wrong. If you left all the boilerplate, then your code should work.
https://sololearn.com/compiler-playground/Wek0V1MyIR2r/?ref=app
https://sololearn.com/compiler-playground/W3uiji9X28C1/?ref=app
+ 2
like Wong Hei Ming have said, it won't work since there is just a single line, you would need like class name, public, static, etc
In the course, sololearn might wrote only one single line like:
System.out.println("Hello World");
But that's just for short, usually see that in questions or when they explain
The code should be:
public class Main {
public static void main(String[] args) {
System.out.println("Hello World");
}
}