Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Beginning Java
Java program file name question
Varun Chopra
Ranch Hand
Posts: 213
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I created following class:
class Student
{
//some code here
}
and saved it in
XYZ.java
I compiled it and got Student.class file, which I was able to run with "java Student"
My question is, why do every book/tutorial say we have to save the program in <classname>.java file? I was able to run it by saving it in XYZ.java.
-Varun -
(
My Blog
) -
Online Certifications
-
Webner Solutions
Joanne Neal
Rancher
Posts: 3742
16
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
All
public
classes have to be created in a file with the same name as the class. Your class isn't public, so you can have any file name you want.
Joanne
Varun Chopra
Ranch Hand
Posts: 213
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Ok great, it's clear.....
-Varun -
(
My Blog
) -
Online Certifications
-
Webner Solutions
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Basic
Naming a java file?
public class inside a package
problem in classpath and jar files and searching
Name of public class same as file
More...