0

System.out.print("hello"); not work

Its not work in jaava

7th Feb 2025, 7:19 AM
Ritesh Dubey
Ritesh Dubey - avatar
3 Respostas
+ 5
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.
7th Feb 2025, 7:28 AM
Wong Hei Ming
Wong Hei Ming - avatar
+ 4
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
7th Feb 2025, 7:34 AM
Ausgrindtube
Ausgrindtube - avatar
+ 4
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"); } }
7th Feb 2025, 5:29 PM
☕︎︎AstroParrot✦
☕︎︎AstroParrot✦ - avatar