-: Java :-
What is java?, History of java ?, and so many questions and answers the more tutorials are explained. But now I am explain only some programs major errors and solved easy way. It's my own experience what errors are faced and how to solved.
Some errors are common to solve but we don't understand the code. So friends we have no time to understand the code. easy way to solve the problems.
Program: Every one learning the java code first program as Hello World ! .So I am also Start Hello World program but in different way see and try this.
Without Main Program How to Write Java Program
Class name: Hello.java
Compile: javac Hello.java
java-code |
Execution: java Hello
//Without main method execute java program
class Hello
{
static //using static block
{
System.out.println("Hello World!");
class Hello
{
static //using static block
{
System.out.println("Hello World!");
//new Hello(); //write this is also
System.exit(0);
}
}
System.exit(0);
}
}
Note : Above program observed once the java program write with out main method. it can possible only before jdk 1.7.
Your version jdk 1.7 the program compile only not an execution.
No comments:
Post a Comment