ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Java Related >> Java J2EE >> Core Java
 
 


 

 
 Core Java interview questions  Core Java Interview Questions (1728)
 Advanced Java interview questions  Advanced Java Interview Questions (332)
 Swing interview questions  Swing Interview Questions (44)
 EJB interview questions  EJB Interview Questions (134)
 Servlets interview questions  Servlets Interview Questions (255)
 Struts interview questions  Struts Interview Questions (196)
 JDBC interview questions  JDBC Interview Questions (187)
 JMS interview questions  JMS Interview Questions (9)
 SunOne interview questions  SunOne Interview Questions (3)
 J2EE interview questions  J2EE Interview Questions (71)
 Weblogic interview questions  Weblogic Interview Questions (147)
 Websphere interview questions  Websphere Interview Questions (14)
 Java Networking interview questions  Java Networking Interview Questions (20)
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions (87)
Question
can we write program without class
 Question Submitted By :: Core-Java
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
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 ?    13 Yes 6 No
Ashok Reddy
 
Answer
# 2
no we cant write any program without class.because its
purely object oriented.
 
Is This Answer Correct ?    6 Yes 1 No
Jain Mayur
 
 
 
Answer
# 3
class with out name is called ananamous class. 
Is This Answer Correct ?    5 Yes 5 No
Sitaram
 
Answer
# 4
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
Bhargavi Rani
 
Answer
# 5
without creating class we will not wtite a program. 
Is This Answer Correct ?    2 Yes 2 No
Poobalan
 
Answer
# 6
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
Mahipal
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
How can be define MARKER interfce in java   1
What are inner and anonymous class?   3
What is data abstraction? Elaborate with example? BMC 4
How Applets & Servlets will communicate with each other?   2
Can an anonymous class be declared as implementing an interface and extending a class?   2
how can u apply shallow cloning and deep cloning to create object? Yash-Technologies 1
A class can be a subclass of itself? Genesis 2
what is private constructor?what are the uses of writing private constructor in our program?   10
what is polymorphism?   4
What do u mean by method and also contructer in java ?   3
What are the override methods in Object class? Tech-Mahindra 2
what ide u r using and wat version, how wil u build the project etc ?   2
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com