Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
JAVA Learning
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VIGNESH VIJAYAKUMAR
JAVA Learning
Commits
e6204a26
Commit
e6204a26
authored
9 months ago
by
VIGNESH VIJAYAKUMAR
Browse files
Options
Downloads
Patches
Plain Diff
Static class
parent
1105d8df
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Core Java/Staticcls.java
+20
-0
20 additions, 0 deletions
Core Java/Staticcls.java
with
20 additions
and
0 deletions
Core Java/Staticcls.java
0 → 100644
+
20
−
0
View file @
e6204a26
public
class
Staticcls
{
public
static
void
main
(
String
[]
args
){
Stat
statObj
=
new
Stat
();
statObj
.
prin
();
}
}
class
Stat
{
//here private class Stat{} is not allowed (protected and static also)
public
void
prin
(){
System
.
out
.
println
(
"This is inside prin.....!"
);
}
}
/*>>in a single java file there should be one public class
>>above package-private class is access by creating obj
>>we cannot declare a top-level class as private or protected we need to keep
public those top-level class if you want to set a class private or protected
we need to keep those in inner class.
>>other than main public class , all other must be pacakge private and may be
private or protected if they are nested class.
*/
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment