can we write program without class

Answer Posted / ashok reddy

2 ans for this question.

1.in a class class name and the constructor is must. so we cant write a file without class.(for this reason only the compiler adds a default constructor)

2.dont write anything inside a text doc(Empty text doc) and save this file as somename.java. it is possible to compile this file but it doesnot produce any .class file.

Is This Answer Correct ?    14 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is abstract class in Java?

765


What is meant by flickering?

736


Does a function need a return?

634


Can we declare a static variable inside a method?

639


What is the difference between @before and @beforeclass annotation?

623






How many bytes is a string java?

624


What modifiers are allowed for methods in an interface?

747


Can we execute a program without main?

624


Can a method inside a interface be declared as final?

602


What are the two parts of a conditional statement?

611


How do you use parseint in java?

603


What does business logic mean?

619


What does it mean to be immutable?

648


What do you mean by platform independence?

676


Write the algorithm to check the number non-leaf nodes in a tree.

721