EvoNext
1.79K subscribers
272 photos
16 videos
266 files
484 links
Download Telegram
EvoNext
LESSON 8: WRAPPER CLASSES IN JAVA βœ…Wrapper classes provide a way to use primitive data types (int, boolean, etc..) as objects. ✳️Sometimes you must use wrapper classes, for example when working with Collection objects, such as ArrayList, where primitive…
LESSON 9: CONSTRUCTORS in Java

✳️ A constructor in Java is a special method that is used to initialize objects. The constructor is called when an object of a class is created. It can be used to set initial values for object attributes.


How Constructors are Different From Methods in Java?

❀️ Constructors must have the same name as the class within which it is defined while it is not necessary for the method in Java.
❀️Constructors do not return any type while method(s) have the return type or void if does not return any value.

❀️Constructors are called only once at the time of Object creation while method(s) can be called any number of times.

Example: look the sample code having two constructors;

package ubJapro1;
//import java.util.*;


public class Firsta {

public static void main(String[] args) {

Firsta2 firs = new Firsta2("ashe",34,76.4);// constructor 1
Firsta2 firs2 = new Firsta2("asegid",32,70.4);// constructor 2

System.out.println(firs.name+" is your name.");

firs2.home();

}





}


Β» share for your programmer friends:
https://t.me/PROGRAMINGLANGUAGES1
EvoNext
LESSON 9: CONSTRUCTORS in Java ✳️ A constructor in Java is a special method that is used to initialize objects. The constructor is called when an object of a class is created. It can be used to set initial values for object attributes. How Constructors…
LESSON 10: Creating objects in java

✳️An object is a basic unit of Object-Oriented Programming and represents the real life entities. It consists of:-
⚜️State means the attributes.
⚜️Behavior means the methods of an object.
⚜️Identity means the unique name to an object.


the four ways of creating objects in java

1. using new key word

//Test t = new Test();
2. Using Class.forName( String className) method;

  Test obj = (Test)Class.forName("com.p1.Test").newInstance();

3. using clone() method

/Test t = new Test();
Test t2 = (Test)t1.clone();

4. Deserialization
it is is technique of reading an object from the saved state in a file.

βœ…example using the first way:

 class Animal {}

class Dog extends Animal {}
class Cat extends Animal {}

public class Test
{
// using Dog object
Animal obj = new Dog();

// using Cat object
obj = new Cat();
}


SUPPORT US BY JOINING AND SHARING;
https://t.me/PROGRAMINGLANGUAGES1: thanks
πŸ‘4
1.Object o = new Object(); 2. Object obj = o; Β»>In the cases given above, identify their difference?
Anonymous Quiz
16%
"o" and "obj" are Objects
39%
"o" is an Object, but "obj" is object variable.
31%
both "o" and "obj" are object variables
14%
NONE
πŸ‘4πŸ”₯1
LEARNtoCODE@javaQuestionsP1.pdf
47.3 KB
Description: Theory_part practice for java
file size: 47.3 kb only
Prepared by: Learn to code();

πŸ—’Java lessons continue on our channel..


Join and share : https://t.me/PROGRAMINGLANGUAGES1
πŸ‘1
🎁🎁GREAT OFFERπŸŽˆπŸŽπŸŽ€


ARE YOU FRESHMAN STUDENT⁉️

Are you looking for freshman reading materials?

then look at this gift for πŸ’―% free:

- modules

- exams[ mid, final] of different universities

- reference books

- and different materials in voice and videos
.... are some of them.

first semister courses:-

βœ…General physics
βœ…mathematics for natural
βœ…mathematics for social
βœ… logic and critical thinking
βœ…communicative english
βœ… Psychology
βœ… Geography


second semister courses:

βœ…Emerging
βœ…general biology
βœ…applied mathematics
βœ…programming I
βœ… civcs and moral education
βœ… economics
βœ… anthropology
βœ…communicative english II

....much more!


https://t.me/exbost
https://t.me/exbost
share for your friend
https://t.me/exbost
https://t.me/exbost
join learn to code
https://t.me/exbost


SHARE FOR YOUR FRIENDS!〽️
❀2πŸ‘1
EvoNext
LESSON 10: Creating objects in java ✳️An object is a basic unit of Object-Oriented Programming and represents the real life entities. It consists of:- ⚜️State means the attributes. ⚜️Behavior…
LESSON 11: ENCAPSULATION

βœ…Encapsulation is defined as the wrapping up of data under a single unit. It is the mechanism that binds together code and the data it manipulates.
Another way to think about encapsulation is, it is a protective shield that prevents the data from being accessed by the code outside this shield.
Following is an example that demonsrates how to achieve encapsualtion in java:

/* File name : EncapTest.java */
public class EncapTest {
private String name;
private String idNum;
private int age;

public int getAge() {
return age;
}

public String getName() {
return name;
}

public String getIdNum() {
return idNum;
}

public void setAge( int newAge) {
age = newAge;
}

public void setName(String newName) {
name = newName;
}

public void setIdNum( String newId) {
idNum = newId;
}
}


// more organized source codes at: https://t.me/java_learntocode

join: Β»https://t.me/PROGRAMINGLANGUAGES1
πŸ‘2
😍Dear members our channel, How are you doing? πŸ˜‡
i hope , you all doing well.πŸ‘
Our CEO πŸ€“ has great intention to help you all in all. He's doing his best to help our family, members of this channel. If any of you have intention to work for shared futureπŸ’ͺ and have good inclination in the staff we engaged in feel free to inbox us.

He prepared member channels for simplifying amount of posts in this channel so,you can use one of them as important:

For Java Β» https://t.me/java_learntocode

For html Β» https://t.me/learncodea

For SQL Β» https://t.me/SQL_learn_to_code {coming soon}

and Meet skilled programmers here >πŸ‘‰ http://t.me/learntocodecpp

" Thanks for your support"
πŸ‘1
✍🏻✍🏻......πŸƒπŸƒπŸƒ......✍🏻✍🏻
Q: Identify the corrected definition of a package.
Anonymous Quiz
29%
a collection of classes
11%
a collection of tools
52%
a collection of classes and interfaces
8%
a collection of interfaces
think-python-2nd.pdf
4.2 MB
Description: material for Python for those only , asking python books‼️
Size: 4.2 MB
credit: MohammedπŸ™πŸ™
πŸ‘‰https://t.me/PROGRAMINGLANGUAGES1
EvoNext
LESSON 11: ENCAPSULATION βœ…Encapsulation is defined as the wrapping up of data under a single unit. It is the mechanism that binds together code and the data it manipulates. Another way to think about encapsulation is, it is a protective shield that…
LESSON 12: POLYMORPHISM

The word polymorphism means having many forms. In simple words, we can define polymorphism as the ability of a message to be displayed in more than one form.

Types of polymorphism

In Java , polymorphism is mainly divided into two types:

i.Compile-time Polymorphism
πŸ’ŽThis type of polymorphism is achieved by function overloading or operator overloading. But Java doesn’t support the Operator Overloading.

ii.Runtime Polymorphism
❀️‍πŸ”₯It is a process in which a function call to the overridden method is resolved at Runtime. This type of polymorphism is achieved by Method Overriding.

>πŸ’— Java program to demostrate polymorphism

class Parent {

// Method of parent class
void Print()
{

// Print statement
System.out.println("parent class");
}
}


// Helper class
class subclass2 extends Parent {

// Method
void Print()
{

// Print statement
System.out.println("subclass2");
}
}

// Class 4
// Main class
class GFG {

// Main driver method
public static void main(String[] args)
{

// Creating object of class 1
Parent a;

// Now we will be calling print methods
// inside main() method

a = new subclass1();
a.Print();


}
}
❀1
Q: The ability to define more than one function with the same name is calledβ€”-;
Anonymous Quiz
13%
Inheritance
16%
Abstraction
67%
polymorphism
4%
Encapsulation
πŸ‘2
Q: Which one is runtime polymorphism?
Anonymous Quiz
43%
MethodeOverridng
32%
MethodeOverloading
21%
Both
4%
NONE
πŸ‘2
WHAT IS THE CORRECT OUTPUT OF THE SNIPPET CODE?
πŸ‘3
EvoNext
LESSON 12: POLYMORPHISM The word polymorphism means having many forms. In simple words, we can define polymorphism as the ability of a message to be displayed in more than one form. Types of polymorphism In Java , polymorphism is mainly divided…
LESSON 13: INHERITANCE

⚜️Inheritance is one of the basic concept in object
orientation in which a new class is created by
absorbing an existing class’s members and
embellishing them with new or modified capabilities.

βœ… The existing class is called the superclass, and the
new class is the subclass.

Syntax for inheritance
class SubClassName extends SuperClassName{};

Why And When To Use "Inheritance"?

- It is useful for code reusability: reuse attributes and methods of an existing class when you create a new class.

Let's explore by using sample code:-
class Vehicle {
protected String brand = "Ford"; // Vehicle attribute
public void honk() { // Vehicle method
System.out.println("Tuut, tuut!");
}
}

class Car
extends Vehicle {
private String modelName = "Mustang"; // Car attribute
public static void main(String[] args) {

// Create a myCar object
Car myCar = new Car();

// Call the honk() method (from the Vehicle class) on the myCar object
myCar.honk();

// Display the value of the brand attribute (from the Vehicle class) and the value of the modelName from the Car class
System.out.println(myCar.brand + " " + myCar.modelName);
}
}


"thanks all!πŸ™"