Learn Computer from the Best Tutors
Search in
Answered on 30/05/2022 Learn Training in Software application usage
Kriya
Answered on 26/03/2022 Learn Software Programming
Ashish Pandey
Certified Microsoft Trainer (MCT) with 7+ years of experience in IT Industry.
Answered on 21/12/2021 Learn Software Programming
Nikhil Bajaj
Software Professional with 15+ Vast experience
Learn Computer from the Best Tutors
Answered on 29/03/2021 Learn Training in Software application usage
Astringe Infosystems
Lesson Posted on 16/02/2021 Learn Java
JAVA OOPs Concepts (Object-Oriented Programming System)
Gaurav Kothari
I am having 8+ years of IT experience in full stack development of java applications. I am B.Tech from...
JAVA OOPs Concepts (Object-Oriented Programming System)
It is primarily having below crucial points. Without below essential points, we will never be able to achieve OOPs in java, PHP, C#, etc. Now let us see the high-level understanding of OOPs concepts.
public class TestCLass1{
//This is a java class
//It can have variables and techniques and some logics
}
public class TestClass { //Here private sTest is wrapped under TestClass
private String sTest="Hi";
public String getsTest() {
return sTest;}
public void setsTest(String sTest) {
this.sTest = sTest;
}}
Please add on comments and like this lesson, if it gave you some revision or refreshment on OOPs concepts.
read lessLesson Posted on 16/02/2021 Learn Java
Gaurav Kothari
I am having 8+ years of IT experience in full stack development of java applications. I am B.Tech from...
JAVA - Object Cloning
Is the way of creating the same copy of object without calling the class constructor. It means we can make any class object multiple times without calling its default constructor. Wherever we required the same object then we can go with cloneable classes as loading of the object is pretty much faster as compared to creating new objects multiple times.
Internally it uses clone() method, which is one of the ways of the object class.
We can achieve cloning by implementing any class with the Cloneable interface.
For more understanding please refer below code.
public class EmployeeCloneable implements Cloneable{
private String name;
private String add;
public EmployeeCloneable(String name, String add){ //Only one time constructor cal
this.name = name;
this.add = add;
System.out.println("I am constructor");
}
public Object clone() throws CloneNotSupportedException{
return super.clone();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAdd() {
return add;
}
public void setAdd(String add) {
this.add = add;
}
public static void main(String[] args) throws CloneNotSupportedException {
EmployeeCloneable emp = new EmployeeCloneable("Test", "1");
//try to use comment line then you will be see two time constrictor call happens
EmployeeCloneable emp1 = (EmployeeCloneable)emp.clone();//new EmployeeCloneable("Test ", "1");
System.out.println(emp);
System.out.println(emp1);
}
@Override
public String toString() {
return "EmployeeCloneable [name=" + name + ", add=" + add + "]";
}
}
Output:
I am constructor
EmployeeCloneable [name=Test, add=1]
EmployeeCloneable [name=Test, add=1]
Please add on comments and like this lesson, if it gave you some revision or refreshment on “JAVA - Object Cloning” concepts.
read lessLearn Computer from the Best Tutors
Answered on 13/02/2021 Learn IT Courses
Ram
I AM A Certified Ethical Hacker | Trainer | Cyber Security | Network Pen Tester | Web Pen Tester.
Lesson Posted on 18/11/2020 Learn Java
Spring - Dependency Injection (DI)
Gaurav Kothari
I am having 8+ years of IT experience in full stack development of java applications. I am B.Tech from...
Spring - Dependency Injection (DI)
DI is a framework which provides loose coupling in code. Here loose coupling means no hard coding of the object. Instead of hard coding, we will be injecting these object from some configurations (XML based, java based, annotation-based).
DI is nothing but design patterns which give you the lightweight loosely couple enterprise application in the result.
What is an injection? -- Inserting of an object/ value into a class whenever the help requires it of third party configurations.
There is two way of achieving Dependency Injection:
Constructor Injection: Injecting any object/ value through the constructor of a class. For, e.g., I have a Test class with the parameterized constructor in it, and I am initializing parameter of that constructor from the external source, i.e. XML file. See how
public class Test {
private int id;
public Test(int id) {
this.id = id;
}
}
XML configuration file: //here now 100 will be assigned to the id of Test class
Setter method Injection: Injecting any object/ value through the setter method of a class. For, e.g., I have a Test class with setter method in it, and I am initializing parameter of that setter method from the external source, i.e. XML file. See how
public class Test {
private int id;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}
XML configuration file: //here now 100 will be assigned to the id of Test class
Please add on comments and like this lesson, if it gave you some revision or refreshment on Spring - Dependency Injection (DI) concepts.
read lessAnswered on 11/10/2020 Learn Computer Course
Anju P.
Computer cum all subject teacher
Learn Computer from the Best Tutors
Answered on 11/09/2021 Learn Software Programming
Anusha
UrbanPro.com helps you to connect with the best Computer Classes in India. Post Your Requirement today and get connected.
Ask a Question
The best tutors for Computer Classes are on UrbanPro
The best Tutors for Computer Classes are on UrbanPro
Book a Free Demo