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

What are register variables what are the advantages?

866


What is the protected method modifier?

990


What is a static class in java?

962


What is nullpointerexception in java?

1042


What is basic syntax?

979


Can we extend private class in java?

932


What is the use of using enum to declare a constant?

958


What is the formula to calculate percentage?

965


Why does java have two ways to create child threads?

911


Can we change the value of static variable?

905


Can we override constructors?

942


Why hashset is used in java?

1003


What is early binding and late binding in java?

1101


What is meant by local variable and instance variable?

981


How to change the priority of thread or how to set priority of thread?

981