What do u mean by method and also contructer in java ?
Answers were Sorted based on User's Feedback
Answer / hira ratan sharma
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 |
Answer / prachi
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 |
Answer / javachi
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 ? | 1 Yes | 0 No |
Explain scope or life time of local variables in java?
What is boolean false?
What are heap memory and stack memory and what are memory tables.
What are the disadvantages of using inner classes?
What is boolean query?
I need to know about complete topic in java's collections i with an examples
I need some details about an employee. i have only the employee id in my presentation layer(JSP).I entered that ID and click "Show Details" Button. Question is how the JSP pass that id to Controller layer and DAO and what mechanism we are using to retrive data from DB and how the data passed to JSP as a Output. Please explain in detail.
Why java is considered as platform independent?
A class can be a subclass of itself?
please tell me what is wrapper class in java with example ?
Which is better singleton or static class?
what is the difference between AWT and SWING what is the advantage of using swing?