#46 Anonymous Object in java

  Рет қаралды 60,246

Telusko

Telusko

Жыл бұрын

Check out our courses:
Enterprise Java Spring Microservices: go.telusko.com/enterpriseJava
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : bit.ly/java-spring-cloud
Coupon: TELUSKO20 (20% Discount)
Udemy Courses:
Java:- bit.ly/JavaUdemyTelusko
Spring:- bit.ly/SpringUdemyTelusko
Java For Programmers:- bit.ly/javaProgrammers
For More Queries WhatsApp or Call on : +919008963671
website : courses.telusko.com/
In this lecture we will learn:
- Object creation in Java
- Anonymous objects in Java
- Difference between Simple objects and Anonymous objects
#1
In JVM, we have both stack memory and heap memory.
- Object is created in the heap memory that contains variable and methods, it also have some address.
- A obj=new A();
obj.show();
here, A is the classname.
obj refers to the address say 101
show() is a method that is called using reference variable obj.
- Every time you call an object, it will call the constructor as well.
- Object creation can be done in two ways:
1. Declare an object - creating a reference
2. Creating an object - and assigning the value to it
e,g., A obj;
obj=new A();
*new A() shows that you are creating an object.
- Reference of an object is created in the stack.
#2
Anonymous Objects:-
Anonymous objects are simply created by using the new keyword.
- It does not have any reference for an anonymous object.
e.g., new A();
- A method can directly be called using this object.
new A().show();
- We can't use the same anonymous object again. It will be use only for one time.
Github repo : github.com/navinreddy20/Javac...
Java:- bit.ly/JavaUdemyTelusko
Spring:- bit.ly/SpringUdemyTelusko
More Learning :
Java :- bit.ly/3x6rr0N
Python :- bit.ly/3GRc7JX
Django :- bit.ly/3MmoJK6
JavaScript :- bit.ly/3tiAlHo
Node JS :- bit.ly/3GT4liq
Rest Api :-bit.ly/3MjhZwt
Servlet :- bit.ly/3Q7eA7k
Spring Framework :- bit.ly/3xi7buh
Design Patterns in Java :- bit.ly/3MocXiq
Docker :- bit.ly/3xjWzLA
Blockchain Tutorial :- bit.ly/3NSbOkc
Corda Tutorial:- bit.ly/3thbUKa
Hyperledger Fabric :- bit.ly/38RZCRB
NoSQL Tutorial :- bit.ly/3aJpRuc
Mysql Tutorial :- bit.ly/3thpr4L
Data Structures using Java :- bit.ly/3MuJa7S
Git Tutorial :- bit.ly/3NXyCPu
Donation:
PayPal Id : navinreddy20
www.telusko.com

Пікірлер: 12
@Prankbaazi
@Prankbaazi Жыл бұрын
Two times constructor running means two new object created. Got it. 🥳
@satyadsp3906
@satyadsp3906 10 ай бұрын
"Everyone hates this type of people" - Telusko to people who get 99/100 😂😂😂 man ur funny
@jenilcaptain6295
@jenilcaptain6295 15 күн бұрын
need a video on garbage collection
@ayushbhargaw5284
@ayushbhargaw5284 9 ай бұрын
I'm a big fan of your python tutorial,
@vickyvignesh897
@vickyvignesh897 Жыл бұрын
creating an object without reference , which can be deleted by garbage collection ryt?
@user-qn7lt2xb1n
@user-qn7lt2xb1n 2 ай бұрын
Whats the use of these anonymous objects?
@akilankanagaraj41
@akilankanagaraj41 8 күн бұрын
When you want to use methods inside another class but don’t want to create an object for it
@smmahadibhuiyan4437
@smmahadibhuiyan4437 2 ай бұрын
deep talks
@mrgold8267
@mrgold8267 Жыл бұрын
👍
@gauravsoni2300
@gauravsoni2300 Жыл бұрын
I give you 99 for teaching, but I can't hate you😅
@kvelez
@kvelez 10 ай бұрын
public class Main{ public static void main(String[] args) {//Main method A a = new A();//Constructor and object creation a.Announcement();//Method call new A().Announcement();//Anonymous object and method call } } class A{//parent class public A(){ //Constructor System.out.println(" Object created."); } public void Announcement(){ System.out.println("NOW in A!"); } }
@redshirtlad
@redshirtlad 2 күн бұрын
marks=99 and then he said...."we hate. everyone hates them" 🤣🤣
#47 Need of Inheritance in Java
6:18
Telusko
Рет қаралды 66 М.
8 Design Patterns EVERY Developer Should Know
9:47
NeetCode
Рет қаралды 1 МЛН
Little brothers couldn't stay calm when they noticed a bin lorry #shorts
00:32
Fabiosa Best Lifehacks
Рет қаралды 4,4 МЛН
Secret Experiment Toothpaste Pt.4 😱 #shorts
00:35
Mr DegrEE
Рет қаралды 39 МЛН
#51 This and Super Method in Java
12:11
Telusko
Рет қаралды 97 М.
Stop, Intel’s Already Dead! - AMD Ryzen 9600X & 9700X Review
13:47
Linus Tech Tips
Рет қаралды 1 МЛН
New AI ROBOT with 3 Brains SHOCKED Experts!
9:16
AI Revolution
Рет қаралды 10 М.
#48 What is Inheritance in Java
8:47
Telusko
Рет қаралды 116 М.
Functional Interface | Lambda Expression in Java
13:56
Telusko
Рет қаралды 143 М.
#58 Object Class equals toString hashcode in Java
12:00
Telusko
Рет қаралды 100 М.
$1 vs $100,000 Slow Motion Camera!
0:44
Hafu Go
Рет қаралды 29 МЛН
Мой новый мега монитор!🤯
1:00
Корнеич
Рет қаралды 3,6 МЛН
low battery 🪫
0:10
dednahype
Рет қаралды 1,8 МЛН
Looks very comfortable. #leddisplay #ledscreen #ledwall #eagerled
0:19
LED Screen Factory-EagerLED
Рет қаралды 13 МЛН