andObject2->max_speed=180miles/hr, model_name="Superfast go", car_name = "BMW",etc.
Constructor
The constructor is a self-executable block where the constructor doesn't need to explicitly define for the functioning calls.
e.g.
public class Month {
public Month() {
// Default Constructor is calling on creating an object of that class.
}
public Month(String month_name) { // Parametrized Constructor
// This constructor has one parameter, month_name.
System.out.println("Month Name = "+month_name);
...
public static void main(StXXXX XXXX[])
{
XXXXX mon=new Month(); // calling XXXXXXX constructor XX default
XXXXX mon1=XXX XXXXX("March"); // calling XXXXXXXXXXXX XXXXXXXXXXX
XXXXXXX XXXXXXXXXXX XX XXX XXXXX XXXXXX XXXX XX XXXXXXXX in the class if it is XXXXXXX and if you define XXX parameter in the XXXXXXXXXXX then it XX called the XXXXXXXXXXXXX constructor.
XXXX Constructor
A copy constructor in a XXXX XXXXX is a constructor XXXXXXXXXXX an XXXXXX XXXXX XXXXXXX object XX XXX XXXX Java class.
That's helpful when XX want to XXXX a XXXXXXX XXXXXX XXXX XXX XXXXXXX fields, or when we XXXX to XXXX a deep XXXX of an XXXXXXXX XXXXXX.
XXXXXX XXXXX XXXXX { private int id; XXXXXXX String XXXXXXXXXX; XXXXXX XXXXX(Month XXXXX) { this.id = XXXXX.id; XXXX.month_name = XXXXX.XXXX; } }
Here, XX XXXX all the XXXXX XXXXXX XX Employee.
Enum (XXXXXXXXXXX)
Enumeration means the list XXXXX XXXXXXXX. At XXX XX you define several XXXXXXXXX in a XXX XXXXXXXXX. It XX XXXXXXX XX XXXXXXX XXXXX "enum" XXX values are XXXXXXXX in the {}.
e.g.enum WeekDays{Sunday, XXXXXX, Tuesday, XXXXXXXXX, XXXXXXXX, Friday,Saturday}
class Month
public static XXXX XXXX(XXXXXX XXXX[])
WeekDays XX; // XXXXXX XXXXXX...
XX=WeekDays.Sunday; //define constant by enum XXXX...
XXXXXX.out.println("XXXXX XX "+wk); // print XXX XXXXX of XXXXXXXX...
} }
XXXXX XXX XXXXXXXXX
XXX array XX used to represent XXX XXXX XXXX of data or which XXX XXXX domain.
e.g.XXXXXX[] months = {"March","XXXXX","May","XXXX"};
XXX (String i: months) {
XXXXXX.out.XXXXXXX(i);
XXXXX List XX a predefined XXXXXXXX present in util package. The XXXX XXXXXXXXXX XXXXXXX XXXXX and ArrayList is ArrayList XX XXXXXXXXX XXX the array XX of fixed size.
XXXXXX XXXX.XXXX.XXXXXXXXX;
public class XXXXX { public static XXXX main(XXXXXX[] XXXX) { ArrayList<String&XX; XXXXXXXXXX = XXX XXXXXXXXX<XXXXXX>(); XXXXXXXXXX.add("September"); XXXXXXXXXX.add("October"); XXXXXXXXXX.add("November"); month_name.add("XXXXXXXX"); XXXXXX.out.XXXXXXX(XXXXXXXXXX); } }
XXXXXXXX XXXXXXX
Function calling is XXXX XX the XXXXXX and callee.
XXXX, XXXXXX is XXX XXXXXXXXX that calls the XXXXXXXXX and XXXXXX XXXXX XXXXXXXX is XX XX XXXX.
XXX XXXXXXX:-
XXXXXX XXXX XXXX(XXXXXX name[]) //XXXXXX
XXXXXX.out.XXXXXXX("I am "+XXXX);
public XXXXXX XXXX XXXX(String args[])
XXXX("XXXXXXX"); //caller
XXXX XX also XXXXmethod XXXXXXXXXXX XXX XXXXXXXXXXXXX-
XXXXX DisplayOverloading //define class DisplayOverloading
public void XXXX(String month) //callee1
XXXXXX.out.XXXXXXX(month);
public XXXX XXXX(String month, XXX id) //XXXXXXX
XXXXXX.out.XXXXXXX(XXXXX+ " - "+id);
class XXXXXX
public XXXXXX void XXXX(XXXXXX args[])
XXXXXXXXXXXXXXXXXX XXX = new DisplayOverloading();
obj.XXXX('February'); // XXXXXXX
obj.disp('XXXXXXX',10); // XXXXXXX
Here, XXXX XXX same XXXX XX a XXXXXXXX XXXXXXXX XXX XX calling the XXXXXXXX their XXXXXXXXXXXXX changes XX XXXXXX XXXXXXXX overloading. XXX function XXXXXXXX XXXXX XXXXXXXX XXXX XXXX name, to differentiate between two functions in this XXXXXXXX, XX XXXXXX looking for XXXXXXXXX XXXXXX XXXX the calling XXXXXXXX.
class XXXXX{ // Parent XXXXX
XXXX XXXXXXXXX={"February","XXXXX","XXXXX"}
//XXXXXXXXXX XXXXXX
public void XXXXXXX(XXX id)
XXXXXXXXX XX;
XXX(XXX i=0;i&XX;XX.length;i++)
if(mn.id == id)
System.out.XXXXXXX(mn.month);
XXXXX XXXXXXX XXXXXXX XXXXX{ // XXXXX Class
//XXXXXXXXXX method
public void getName(XXX id)
Monthname XX;
XXX(XXX i=X;i<mn.XXXXXX;i++)
XXXXXX.out.XXXXXXX("XXXX XX the month XX "+XX.month +" and id XX " + mn.id);
public XXXXXX XXXX XXXX( XXXXXX XXXX[]) {
XXXXXXX XXX = new MyMonth();
//XXXX XXXX XXXX the child class XXXXXXX of eat()
obj.getName(2);
Overriding method is XXXXXXXX similarly to XXXXXXXXXXX XXX overriding deals XXXX the XXXX name XXX XXX XXXX number XX XXXXXXXXXX initialize.
XXXXXXXXXX XXXXXX occur XXXXXXX XXX or more classes XXXXX XX inherited XX each XXXXX XXXXX child XXXXX have the XXXX name of XXX XXXXXXXX XXXX the XXXX XXXXXX XX XXX parameter XX XXX parent class has XXXX XXXXX class XXXXXX it's own XXXXXXXX XXX it's XXXXXX XXXXXXXX. is called XXXXXX overriding. XX access XXX XXXXXX XXXXXXXX we use super() XXXXXX or XXXX() method XX reference XXX parent's XXXXXX.
Pseudocode XXX XXXXXXXXXX Snippet
XXXXXXX to SIM Set XXXXXX XXXXXX
X: XXXXXXXXXX of set 1: XXXXX example 2: Intersection XXXXXXX 3. Subset example 4. XXXXXXXXXX example X. XXXXXXXXXX example 6. Sets XXXXXXXX XXXXXXX X.XXXX
Code for XXXX Snippet :-
import XXXX.util.Scanner;
XXXXX XXXXX{
XXXX Month_name {January,XXXXXXXX,March,XXXXX,XXX,XXXX,July,August,September,October,XXXXXXXX,December};
XXXXXXXXX&XX;String&XX; a = new XXXXXXXXX<String>; // creating ArrayList for set X... a.add("XXX"); a.add("XXX"); a.add("May); a.add("Oct"); a.add("Sep"); a.add("XXX"); a.add("Jun");
ArrayList&XX;String> b=new XXXXXXXXX&XX;XXXXXX>; // creating XXXXXXXXX for set B... b.add("XXX"); b.add("XXX"); b.add("XXX");
XXXXXX Month() { // XXXXXXXX constructor }
public XXXXXX XXXX Properties_of_set() { // XXXXX XXXX own XXXX XXXX... }
XXXXXX XXXXXX void XXXXXXXXXXXXX() { // write XXXX own XXXX XXXX... }
XXXXXX XXXXXX void Intersection_example() { // write your own code XXXX... }
XXXXXX static XXXX Subset_example() { // write XXXX own XXXX here... }
XXXXXX XXXXXX void Difference_example() { // write XXXX own code here... }
public static XXXX Complement_example() { // write your own code XXXX... }
XXXXXX XXXXXX XXXX XXXXXXXXXXXXXXXXXXXXX() { // write your own XXXX here... }
public static void Quit() { // XXXXX your own XXXX here... }
public static XXXX main(String args[]){ XXXXXXX in = XXX Scanner(System.in); XXXXXX.out.XXXXXXX("Welcome XX XXX Set XXXXXX lesson\n 0: Properties of XXX\n X: XXXXX XXXXXXX\n X: XXXXXXXXXXXX XXXXXXX\n X. Subset example\n 4. XXXXXXXXXX example\n X. XXXXXXXXXX example\n 6. Sets equality XXXXXXX\n 9.Quiz\n"); System.out.XXXXX("Your option: "); int XXXXXX=in.XXXXXXX();
XXXXXX(XX) { XXXX X : Properties_of_set(); XXXXX; case X: XXXXXXXXXXXXX(); XXXXX; XXXX 2: XXXXXXXXXXXXXXXXXXXX(); break; case 3: XXXXXXXXXXXXXX(); XXXXX; XXXX X: Difference_example(); break; case X: XXXXXXXXXXXXXXXXXX(); break; case 6: Sets_equality_example(); XXXXX; case X: XXXX(); XXXXX; default: XXXXXX.out.println("XXXXXXX XXXXXX"); break; } } }