Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What do u mean by method and also contructer in java ?

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Make a data structure and implement an algorithm to print all the files in a directory. (The root directory can have sub-directories too.)

1324


What is string data?

977


What is the use of set in java?

1115


What does a boolean method return?

1220


What is the difference between the direct buffer and non-direct buffer in java?

1022


Is integer a class?

1073


What is difference between protected and private?

1061


What is static and final keyword in java?

1013


What is classname class in java?

1050


What is an iterator interface in java programming?

945


What are keywords and reserved words in java?

1050


How transient variable is different from volatile variable?

1070


What is the difference between overriding and overloading in OOPS.

1142


What is the default value of local and global variables?

1086


Explain about features of local inner class?

1123