how to identify method,attribute,variable,datatype,object in java program?give the explanation with program.
Method: Java statements are grouped together in methods. Each method must be inside a class. Every method has a name, which starts with a lowercase character.You can identify a method name because it is always followed by left and right parentheses, which may enclose arguments (parameters).
Example:
public void hello(String name){ System.out.println("Hello "+ name); }
Here hello() is method.
Variables: A variable refers to the memory location that holds values like: numbers, texts etc. in the computer memory. A variable is a name of location where the data is stored when a program executes.
Example:
boolean value=true; int i=5;
Here variables are value and i respectively.
datatype: The type of value that a variable can hold is called data type.
Example:
boolean value=true; int i=5;
Here boolean and int are datatype.
Object: An object is a runtime entity which is created by a class. It is a software bundle of variables and related methods.
Example:
Integer ig=new Integer();
Here ig is an object
Attribute: An instance or static variable, usually called a field.
Example:
Integer ig=new Integer(Integer.SIZE);
Here SIZE is an attribute
Method: Java statements are grouped together in methods. Each method must be inside a class. Every method has a name, which starts with a lowercase character.You can identify a method name because it is always followed by left and right parentheses, which may enclose arguments (parameters).
Example:
public void hello(String name){ System.out.println("Hello "+ name); }
Here hello() is method.
Variables: A variable refers to the memory location that holds values like: numbers, texts etc. in the computer memory. A variable is a name of location where the data is stored when a program executes.
Example:
boolean value=true; int i=5;
Here variables are value and i respectively.
datatype: The type of value that a variable can hold is called data type.
Example:
boolean value=true; int i=5;
Here boolean and int are datatype.
Object: An object is a runtime entity which is created by a class. It is a software bundle of variables and related methods.
Example:
Integer ig=new Integer();
Here ig is an object
Attribute: An instance or static variable, usually called a field.
Example:
Integer ig=new Integer(Integer.SIZE);
Here SIZE is an attribute
Method: Java statements are grouped together in methods. Each method must be inside a class. Every method has a name, which starts with a lowercase character.You can identify a method name because it is always followed by left and right parentheses, which may enclose arguments (parameters).
Example:
public void hello(String name){ System.out.println("Hello "+ name); }
Here hello() is method.
Variables: A variable refers to the memory location that holds values like: numbers, texts etc. in the computer memory. A variable is a name of location where the data is stored when a program executes.
Example:
boolean value=true; int i=5;
Here variables are value and i respectively.
datatype: The type of value that a variable can hold is called data type.
Example:
boolean value=true; int i=5;
Here boolean and int are datatype.
Object: An object is a runtime entity which is created by a class. It is a software bundle of variables and related methods.
Example:
Integer ig=new Integer();
Here ig is an object
Attribute: An instance or static variable, usually called a field.
Example:
Integer ig=new Integer(Integer.SIZE);
Here SIZE is an attribute