What do u mean by method and also contructer in java ?
Answer Posted / 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 |
Post New Answer View All Answers
Is it possible to override the main method?
Difference between vector and arraylist.
What are actual parameters?
What does the “static” keyword mean?
What does indexof mean?
what is inner class in java?
Is it possible for a yielded thread to get chance for its execution again?
Why does java does not support multiple inheritance? Explain
How big is a pointer?
when a request is generated from apache tomcat 5.5 and goes to oracle 10g or mysql,,, how the oracle or mysql reads the request as apache is a web server and oracle 10g is application server? when the oracle 10g provides response, how the apche tomcat reads it???
Explain the access modifiers for a class, method and variables?
What is the differences between heap and stack memory in java? Explain
What do you understand by a Static Variable?
explain copyonwritearraylist and when do we use copyonwritearraylist?
How do you download stubs from Remote place?