without class non of the folder can run so the java program should start in class we can use the class without object in java
If it is already compiled, you can start your Java program from the command line. Just type java myclass replacing "myclass" with the program you want to start - a program with the ".class" extension, for example, myclass.class.
Class declaration
In C, no. In Java, yes.
The java interpreter or JVM (Java Virtual Machine) is not able to execute the java source code for a program. The java source code first needs to be compiled into bytecode that can be processed by JVM. Producing bytecode make the program platform independent as each platform has its own JVM. It is also possible to directly write bytecode, bypassing the need to compile, but that would be tedious job and also not good for security purpose as the compiler checks for various errors in a program.
The command to compile a Java program is "javac", followed by the class name (file name).
If it is already compiled, you can start your Java program from the command line. Just type java myclass replacing "myclass" with the program you want to start - a program with the ".class" extension, for example, myclass.class.
Nothing will happen. There is no restriction that every Java class must have a main method. The only program is that, this class cannot be executed as a standalone java program.
Class declaration
You can run a Java application from the command line using "java <name of the class>"
In C, no. In Java, yes.
Yes, executing a Java class will require memory just like any other program.
The java interpreter or JVM (Java Virtual Machine) is not able to execute the java source code for a program. The java source code first needs to be compiled into bytecode that can be processed by JVM. Producing bytecode make the program platform independent as each platform has its own JVM. It is also possible to directly write bytecode, bypassing the need to compile, but that would be tedious job and also not good for security purpose as the compiler checks for various errors in a program.
For run the program
The command to compile a Java program is "javac", followed by the class name (file name).
The command is "java", followed by the class name. For example, if your compiled class is called myclass.class, you give the command: java myclass
Because you are creating a class - a class in the sense of OOP.
The fundamental structure of any Java programme should look like: [package declarations] [import statements] [class declaration] An example is given below: package abc; import java.lang; class Demo { public static void main(String[] args) { Sytem.out.println("Hello! World"); } } //The file containing this class must be named Demo.java