Hi,

This Article Based on Java Program, without main () function
"Java is class based object oriented programming Language"...
Example:
class Math
{
Static   //main() is not use this program
{
int a, b, c;
a=12;
b=5;
c=a+b;
if(c==a+b)
{
System.out.println("a+b\t" +c );
c=a-b;
if(c==a-b)
{
System.out.println("a-b\t" +c);
c=a*b;
if(c==a*b)
{
System.out.println("a*b\t" +c);
c=a/b;
if(c==a/b)
{
System.out.println("a/b\t" +c);
}
else
{
System.out.println("No result");
}
}
}
}
}
}

Create this program in notepad and open CMD and got to location where your program have save as like suppose desktop then type cd desktop then you see CMD



Then my program file save in new folder as like java prog so then I command use cd java prog then seen CMD

Then seen output use command for compile java program
Javac math.java
    When compile program then automatically generate class file go to java prog folder or own location where you save math.java program.
It is compile successfully no any error…
After that run the java program use command java and class name …as like this…
Java math
Seen CMD for output..
Finally no any error compiles and run time … only exception at after rum and output but before not any exception…



 By KR...

2 comments:

  1. Nice article...please explain how it is executed???

    ReplyDelete
  2. YES OFCOURSE USING STATIC WITHOUT MAIN() ITS EXCUTED NOT ANY ERROR AND WXCEPTION AT COMPILE AND RUN TIME ..

    ReplyDelete

Rate me

Free Rating Code
 
Top
How to Become Author of TechFusion || write your suggestion and idea on comment box, we try to implement it.