can we write program without class

Answers were Sorted based on User's Feedback



can we write program without class..

Answer / 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

can we write program without class..

Answer / jain mayur

no we cant write any program without class.because its
purely object oriented.

Is This Answer Correct ?    6 Yes 1 No

can we write program without class..

Answer / sitaram

class with out name is called ananamous class.

Is This Answer Correct ?    5 Yes 5 No

can we write program without class..

Answer / bhargavi rani

no.becoz java is pure object oriented language.so all the
member functions and datamembers must be write inside the
class.here we can also say that class is an example for
encapsulation.encapsulation is binding data and member
functions in a single unit.

Is This Answer Correct ?    2 Yes 2 No

can we write program without class..

Answer / poobalan

without creating class we will not wtite a program.

Is This Answer Correct ?    2 Yes 2 No

can we write program without class..

Answer / mahipal

no,because java is purely object oriented language,so we can't create the objects with out writing a class.And also we can save the code as classname.java that's the reason also we must create a class

Is This Answer Correct ?    3 Yes 4 No

Post New Answer

More Core Java Interview Questions

Hi Friends, I am new to java. Can u explain about thread concept.How i know one thread is locked, and how can i force or acquire another thread for lock . Finally how to know thread is released from lock. Explain types of lock(like method level and block level) in thread.

1 Answers  


What is the use of using enum to declare a constant?

0 Answers   Fidelity,


how to use this key word in java programming?

7 Answers  


how to handle a singleton service locator. when multiple threads are trying to get the singleton object in same time

4 Answers   Mind Tree,


Difference between process and thread?

0 Answers   HP,






What error occurs if a try-catch-finally statement sequence does not have a catch clause?

4 Answers  


In what types of operations an ArithmeticException will be thrown?

3 Answers  


What is a literal coding?

0 Answers  


Which class represents the socket that both the client and server use to communicate with each other?

0 Answers  


What is assembly language?

0 Answers  


what is the difference between statis block and static variable

7 Answers  


what is for datainputstream?

1 Answers  


Categories