top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Is empty .java file name a valid source file name?

+1 vote
815 views
Is empty .java file name a valid source file name?
posted May 18, 2018 by Frank Lee

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Yes, save your java file by .java then compile it by javac .java and run by java yourclassname

 class X { 
        public static void main(String args[]) {
            System.out.println("Hello World");
        } 
    } 

to compile - javac .java

to execute - java X

Credits : https://stackoverflow.com/questions/29827900/is-empty-java-file-name-working

answer May 22, 2018 by Manish Tiwari
Similar Questions
0 votes

Please help me with a sample program to check whether given matrix is valid sudoku solution or not. Input would be matrix of n*n size and validate grids of sqrt(n)*sqrt(n) size along with row and columns.

+3 votes

Implement a code that counts the occurrences of each word in an input file and write the word along with corresponding count in an output file sorted by the words alphabetically.

Sample Input

Gaurav is  a Good Boy
Sita is a Good Girl
Tommy is  a Good Dog
Ram is a Good person

Sample Output

D:\>Java FileWordCount inputFile.txt outputFile.txt
    Boy : 1
    Dog : 1
    Gaurav : 1
    Girl : 1
    Good : 4
    Ram : 1
    Sita : 1
    Tommy : 1
    a : 4
    is : 4
    person : 1
...