Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
4

Changing the main class name in Java -- is it possible?

LisaKossiver
LisaKossiver

In Java there is no way to change the class name or the java file away from Main, and give it a meaningful name?

2 years ago
You are viewing a single comment. View All
3
PattanAhmed
PattanAhmed

@LisaKossiver
Hi,
By reading all of these websites, I came to the conclusion that You cannot rename the main file in any of Programming Language.
The sources that I referred were:-
Click here
Click here
Click here

But

You can create a new file and rename it with your choice...
Unfortunately, you cannot rename the original (main.java) to somewhat other.

If

you wanted to run your second file, then write this code into your main file:-

otherfile.main(args);

If

You wanted to rename your file on Desktop then, You can download it as a zip and extract it, and then you can rename it.

That's probably unrelated here :D

Hope this helps

Please mark my answer if this helps

2 years ago