class is design to specify the attributes and behavior of object .Attributes of an object are implemented using
variables and the behaviors of an object are implemented using methods
## Variables -- instance variables , instance attributes
Store state of an object .
each object has its own copy of instance variable .Define inside class and outside all methods .
class variable , static variable - Single copy of variable is shared among all objects .
## Methods -- instance methods , are manipulate instance variables
class methods , static methods , are can be used to manipulate static methods
## Constructors -- used to create and initialize objects of a class
## Packages -- allows to group together a related set of classes and interfaces .
package names , should be in lower case
## Import -- import statement doesn't embed the content of the imported class in our class .So importing more classes
doesn't increase size of our class .
when importing multiple classes with same name
java.util.Date date1 ;
java.sql.Date date2 ;
## access modifiers - control accessibility of class and its members outside the class and package .
## non access modifier - changes default behavior of class and its members .
abstract , static , final , synchronized , native , strictfp , transient , volatile
## final modifier can't be used with the declaration of an interface.
class that is marked final can't be extended by another class .
final variable can't be reassigned a value . It can be assigned a value only once.
If a reference variable is defined as a final variable ,we can 't reassign another object to it .
But we can call methods on this variable (that modify its state)
final method defined in a base class can't be overridden by a derived class .
## static variables belong to a class .
They 're common to all instances of class and aren't unique to any instance of a class.
static attributes exist independently of any instances of a class and may be accessed even when no instances
of the class have been created
static methods aren't associated with objects and can't use any of the instance variables
of a class.
It is common practice to use static methods to define utility methods , which are methods that usually
manipulate the method parameters to compute and return appropriate value.
static double interest (double num1 , double num2 , double num3){
return (num1 + num2)
}
static final int variableConstantName = 6;
Thursday, March 15, 2018
Subscribe to:
Posts (Atom)
The AI Driven Software Developer, Optimize Innovate Transform
The AI-Driven Software Developer: Optimize, Innovate, Transform": AI Transformation in Software Development : Understand how AI is re...

-
What is HTTP? HTTP is stands for Hypertext Transfer Protocol. HTTP offers set of rules and standards for web browsers & servers ...
-
In web.xml file add this , <context-param> <param-name>primefaces.THEME</param-name> <par...