JVM

October 3, 2008

When the JVM (Java Virtual Machine) starts running, it looks for the class you give it the command line. Then its starts looking for a specially-written method that looks exactly like:

public static void main(String args[])

{
//your code……
}

Next, the JVM runs everything between the curly braces {} of your main method. Every Java application has to have at least one Class, and at least one main method (not one main per class; just one main per application).

In Java, everything goes in a class. You’ll type your source code file (with a .java extension), then compile it into a new class file (with a .class extension). When your run your program, you’re really running a class.

Running a program means telling the Java Virtual Machine (JVM) to “Load the 9lessons class, then start executing its main() method. Keep running till all the code in main is finished.

The main() method is where your program starts running.

9lessons.java:

public class 9lessons
{
public static void main(String[] args)
{
System.out.println(“Programming Blog”);
}

}

step 1: javac 9lessons.java

step 2: java 9lessons

The Big Difference Between public class and Default class

9lessons.java:

public class program
{
public static void main(String[] args)
{
System.out.println(“Programming Blog”);
}
}

Above program file name is (9lessons.java) and public class name (program) is different


Error : Class program is public, should be declared in a file named program.java

So public class means file name and class name must be same..

Here Default Class(no public)

9lessons.java:

class program
{
public static void main(String[] args)
{
System.out.println(“Programming Blog”);
}
}

After compiling 9lesson.java creates program.class

In the Default class no need to give file name and class name same..

step 1: javac 9lessons.java

step 2: java program

Java 2: The Complete Reference

October 2, 2008

Java 2: The Complete Reference

Java Design Patterns

October 2, 2008

Java Design Patterns

Java Programming

October 2, 2008

Java Programming

Struts Tutorial

October 2, 2008

Struts Tutorial

SQL Reference

October 2, 2008

SQL Reference

Hibernate Reference

October 2, 2008

Hibernate Reference Documentation

JavaScript Bible

October 2, 2008

JavaScript Bible

SCJP(310-355) Dumps 02

September 16, 2009

SCJP(310-355) Dumps 02

SCJP(310-355) Dumps 01

September 16, 2009

SCJP(310-355) Dumps 01

Follow

Get every new post delivered to your Inbox.