if a java file without any source code is valid java file?

Answers were Sorted based on User's Feedback



if a java file without any source code is valid java file?..

Answer / kartik kudada

Yes, It is possible .

java file can be empty.
You could check it eclipse.

Is This Answer Correct ?    15 Yes 3 No

if a java file without any source code is valid java file?..

Answer / gaurav kumar

yes a java file without any source code is valid java file.
it will compile without any error but while running it gives
error-
"could not find or load main class----"

Is This Answer Correct ?    0 Yes 0 No

if a java file without any source code is valid java file?..

Answer / la_di

(I suppose you mean IS not IF)

No, an empty file is not a valid java file since you have
to use the same class-name as file name. (A file with a
valid class declaration but an empty body is valid thou)

Is This Answer Correct ?    5 Yes 11 No

Post New Answer

More Core Java Interview Questions

perpare on factorypattern,linklist wothout using collection, (multitharding ie create producer/customer therad producer create Queue continuesly,consumer consume queue, consumer wait if queue is full,producer wait if queue is empty),diff betn sleep(1000)&wait(1000) these r the main Q ask in huawei(2008)

1 Answers   Huawei,


State the merge-sort principle and its time complexity.

0 Answers   Akamai Technologies,


Can It is possible to synchronize the constructor of a Java Class?

0 Answers  


Why main function is static?

0 Answers   MCN Solutions,


What is the difference between the synchronized() & static synchronized()?

2 Answers   HP, SparkTG,






What is append in java?

0 Answers  


What are three advantages of using functions?

0 Answers  


explain System.out.println

107 Answers   Calpine Technologies, Care, Cognizant, CTS, IBM, IBS, LibSys, Oracle, Spiro Solutions, TCS,


How is hashcode calculated in java?

0 Answers  


Why webdriver is an interface?

0 Answers  


what is mutual exclusion? : Java thread

0 Answers  


what is anonymous class in java?

0 Answers  


Categories