0 votes
103 views
in JAVA by (98.9k points)
edited
is Empty .java file name a valid source file name?

1 Answer

0 votes
by (98.9k points)
selected by
 
Best answer

Yes, Java allows to save our java file by .java only, we need to compile it by javac .java and run by java classname Let's take a simple example:

  1. //save by .java only  
  2. class A{  
  3. public static void main(String args[]){  
  4. System.out.println("Hello java");  
  5. }  
  6. }  
  7. //compile by javac .java  
  8. //run by     java A  

compile it by javac .java

run it by java A

Related questions

0 votes
1 answer 2.8k views
0 votes
1 answer 247 views

Doubtly is an online community for engineering students, offering:

  • Free viva questions PDFs
  • Previous year question papers (PYQs)
  • Academic doubt solutions
  • Expert-guided solutions

Get the pro version for free by logging in!

5.7k questions

5.1k answers

108 comments

557 users

...