can two class in a code be public??if yes then how??
Answers were Sorted based on User's Feedback
Answer / sreejesh1987
One java source file must have only one top-level(top level means not an inner class) public class with the same name as the name of the source file .
You can have inner classes to a class which are public. Hence in this way it is possible to have more than one public class in a single file.
| Is This Answer Correct ? | 11 Yes | 2 No |
Answer / siva
NO only one class should be public if we write multiple
classes in a same file.we can write multiple class files in
a single file.if main() is there in one of the classes then
it should be declare as public.
| Is This Answer Correct ? | 5 Yes | 0 No |
Can I override protected method in java?
How to find the given number is a prime number or not by getting input from the user
where do you place after you did code in java
There can be a abstract class without abstract methods, but what is the need to declare a class abstract if it doesn't contain abstract methods?
How is garbage collection controlled?
Which data type is a class in java?
What are the three types of design patterns?
What is meant by event handling in SAX parser?
How many types of exception can occur in a java program?
These static constructors are correct ? class A { statc intA() { } static A(int x,int y) { } static A(int x) { } }
What kind of variables a class can consist of?
What is token in java?