-
Junior Member
Question
can i run a program without main in java, if so write the code for that
-
Re: Question
Question moved to proper forum .
-
Junior Member
Answer for writing java prog without main()
Yes,we can write .
class X
{
static{
System.out.println("This is static block");
public void show(){System.out.println("This is show()");
}
/**u can place System.exit(0); to ignore exception
*/
System.exit(0);
}//static block end here
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules