run a java class without main method
//This is prior to Java 7
class StaticInitializationBlock{
static{
System.out.println("class without a main method");
System.exit(0);
}
}
run a java class without main method
//This is prior to Java 7
class StaticInitializationBlock{
static{
System.out.println("class without a main method");
System.exit(0);
}
}
can i call another function from main hava
package learningjava;
public class helloworld {
public static void main(String[] args) {
new helloworld().go();
// OR
helloworld.get();
}
public void go(){
System.out.println("Hello World");
}
public static void get(){
System.out.println("Hello World, Again");
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us