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 singleton class be serialized?
How do you remove all elements from an arraylist in java?
What is string data type?
Difference between a class and an object?
Give me an example of array and linked list? Where they can be used?
what is meaning of JIT?
What is number data type?
What is the Set interface?
What is a superclass?
What is an example of a boolean?
Can we add two byte variables and assign the result to a byte variable ? b=b1+b2 where b,b1,b2 are byte types
What releases of Java technology are currently available? What do they contain?