Showing posts with label Declaration_&_Access_Modifiers. Show all posts
Showing posts with label Declaration_&_Access_Modifiers. Show all posts

Tuesday, August 2, 2022

Declaration_&_Access_Modifiers

Selection statements
A java Program can contain any no. Of classes but at most one class can be declared as public. "If there is a public class the name of the Program and name of the public class must be matched otherwise we will get compile time error".

If there is no public class then any name we gives for java source file.



Case 1:
  •   If there is no public class then we can use any name for java source file there are no restrictions.
Example:
  A.java
  B.java
  C.java
  Ashok.java




You may also like

Kubernetes Microservices
Python AI/ML
Spring Framework Spring Boot
Core Java Java Coding Question
Maven AWS