0
Error in printing hello world
Myclass { public static void main(String[] args) { System.out.println("hello world"); } }
3 Answers
+ 1
ARMY prime
Class declaration syntax is
class Class_Name
{
//Data and properties goes here..
..
}
in your code
class MyClass //you missing class keyboard here.
{
public static void main(String args[])
{
System.out.println("hello world");
}
}
+ 1
ARMY prime When you are going to define something you should tell their type. Like if you are making class you should write like this:-
class Class_Name {
}
when you are going to write method you should declare which type of method and what will return like this:-
void methodName() {
}
Or
int methodName () {
}
When you are going to make Interfare you should write interface before the interfaceName like this:-
interface interfaceName {
}
0
We need to write like
class MyClass. and remember that java is a case sensitive language