answersLogoWhite

0

We can't call a class. We always call a method in java.

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

What will happen if a Java Class has no Main Method?

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.


Is it possible to override the main method in Java?

Theoretically yes. You will use only one main method for your whole java application and hence such a situation will not come up in real life. Imagine: You have a main in class A and one more in class B which extends class A. When you try to run the class B, only that main method will be executed and not the main in class A. So this override is irrelevant and we cannot call class A's main method at all


What is a driver class in Java?

The driver class is often the class that contains the "Main" method.


Are you allowed to declared main method in every class?

Yes. Every Java class can have a main method


Can a class get compilled without main in java?

No, all classes MUST have a main method.


How do you print message before main in java?

You cannot do that. The main method of a java class is the point where the execution begins. You can print messages only after a main method is invoked.


Is main a predefined function in java?

No. It is a user defined function which the person who is creating the java class has to code by himself.


What is the skeleton of java?

The skeleton of Java refers to the fundamental structure of a Java program, which typically includes the main class declaration, the main method, and any necessary import statements. A basic Java program starts with the public class keyword followed by the class name, and the public static void main(String[] args) method serves as the entry point for execution. This structure allows the Java Virtual Machine (JVM) to identify and run the program. Additional methods and variables can be defined within the class to extend its functionality.


How do you call a method from inside the main method?

I assume the question is about Java. How you call a method from inside the main method depends on whether this is an instance method or a static method. To call an instance method, you need to have a valid instance. Say foo is an instance of class Foo, which was created inside the main method. Then to call the instance method implode() use foo.implode() To call the static method bar() of class Foo, use Foo.bar().


Is the any class containing main function in a webapplicatin?

No. Java classes in web applications do not have Main Methods.


Extension file for Java?

Java source files have the .java extension, compiled Java class files have the .class extension.


Resolve this error 4 java --Exception in thread main java.lang.UnsupportedClassVersionError milan Unsupported major.minor version 49.0?

The class/jar was compiled with a later major version of java than the version of java you are using to run the code with. So for instance the class was compiled with java 1.5 and you are running the class with java 1.4, which doesn't understand the format of 1.5 class files. check "java -version" from the command prompt.