ALLInterview.com :: Home Page KalAajKal.com
 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                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
What do u mean by method and also contructer in java ?
 Question Submitted By :: Matrix55
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What do u mean by method and also contructer in java ?
Answer
# 1
Java methods are similar to functions or procedures in other
programming languages.

Every Java program must have one main() method.

Here is the main() method from a Java program which prints
"Hello World":

public static void main (String[] args) {
// This Java program prints "Hello World!"
System.out.println{"Hello World!");


A constructor creates an Object of the class that it is in
by initializing all the instance variables and creating a
place in memory to hold the Object. It is always used with
the keyword new and then the Class name. For instance, new
String(); constructs a new String object. 

COnstructors are basically used to initialize the attributes
of the class.
 
Is This Answer Correct ?    6 Yes 0 No
Hira Ratan Sharma
 
  Re: What do u mean by method and also contructer in java ?
Answer
# 2
Java methods are similar to functions or procedures in other
programming languages.

Every Java program must have one main() method.

Here is the main() method from a Java program which prints
"Hello World":

public static void main (String[] args) {
// This Java program prints "Hello World!"
System.out.println{"Hello World!");


A constructor creates an Object of the class that it is in
by initializing all the instance variables and creating a
place in memory to hold the Object. It is always used with
the keyword new and then the Class name. For instance, new
String(); constructs a new String object. 

COnstructors are basically used to initialize the attributes
of the class.
 
Is This Answer Correct ?    2 Yes 0 No
Prachi
 
 
 
  Re: What do u mean by method and also contructer in java ?
Answer
# 3
A method is a procedure to call the objects with their properties within or outside the classes, method is considered in object oriented programming as functions in structured programming. 

constructor is a method used only for initializing the variables of the object class. this will reduce the code compatibility.
 
Is This Answer Correct ?    0 Yes 0 No
Javachi
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
explain System.out.println() CTS7
why is multiple inheritance not allowed in java? Elementus-Technologies5
What is OOP? BMC2
When does the compiler supply a default constructor for a class? TCS8
what is java bean?where can we use it? TCS3
what are class,constructor and primitive data types?  2
what is difference between throw and throws in exception?  16
How can final class be used? Wipro2
What is the format of Inner Class after it compiled?  1
What are inner and anonymous class?  2
How do you set security in applets? Wipro1
What are the ways of polymorphism other than Overridding & Overloading  1
What is the use join() in Threads ? HCL4
what is the difference between @include page and @include file  2
What is garbage collection in Java, and how can it be used ? Wipro10
How the elements are organized in GridLayout?  1
What is the default modifier in Interface?  4
What is cloneable interface?  5
What are E and PI?  1
What is interface and its use? HCL6
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com