Why only one Class is public in one file? Explain in
details. Thanks in Advance.
Answer Posted / ganesh slv
You can create one or more classes in single file. Only one
class may be declared as public. This is your Optional.
If you declared a class as public, your file name should be
the save of your class name.
Public class can be accessible from other applications.
Example, your applet code can be run in a web browser. This
public class may execute other classes in the same file.
If you declared two classes as public, your file name will
be what?
Note the Example :
class First {
// Some codes here
}
public class Second {
// some codes here
// In core, your main method should be here.
// You have to save the file as Second.
}
Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
What is charat java?
What method is used to specify a container's layout in java programming?
How to display all the prime numbers between 1 and 100
Is call by reference possible in java?
What is the purpose of format function?
What is r in java?
What is variable explain?
What are keywords in programming?
What is the main advantage of passing argument by reference?
What is the list interface?
How do you call a reference in java?
How to compare two strings in java program?
Why java is platform independent? Explain.
Explain which of the following methods releases the lock when yield(), join(),sleep(),wait(),notify(), notifyall() methods are executed?
What is the difference between declaration and definition in java?