35 Java Reference Types vs. Primitive Types Example |

preview_player
Показать описание
"Learn How To Design + Code A Complete App From Scratch To Playstore"
-~-~~-~~~-~~-~-

This Java Tutorial video tries to show the difference between primitive data types and object references. It creates 2 primitive variables first and tries to give one value to the other and demonstrates the effect of a change. It then creates 2 object reference variables, demonstrates the effect of a change and shows the difference.

OUR WEBSITE

OUR SOCIAL LINKS
Follow us on
Рекомендации по теме
Комментарии
Автор

Thanks a lot, I could finally understand:
String x -> primitive type
Test x -> reference type
Wonderful video!

andrewf.
Автор

237 FREE Java slides!!!
These slides teach you everything you need to get started with Java programming. I will be adding a PART 3 in addition to the two parts that will cover more complex topics. I was so excited with these that I couldn't wait to upload it ASAP!

slidenerd
Автор

you are such a life-saver, thank you! :)

isabelleus
Автор

Your Tutorials are really good man Thanks

phutimatle
Автор

All's very clear, still I've noticed when you declare Test b it doesn't have a constructor. So is this because it's just a reference and not an actual object? And if so does references need to be preceded by the class they are referencing?

riskromer
Автор

Thank You for your videos, they are very helpful.

mariacarroll
Автор

Why does the same not happen with Strings . A string variable is also on object of class String

kunalnalawade
Автор

which book would you suggest for java..!??

arush
Автор

Hello Slidenerd, I always get confused wid actual and formal parameters in java...can u clear that to me plzz...!!

neerajg
Автор

slidenerd i also tried but it didn't change anything .

mahfuzsozeeb
Автор

Hi All/slidenerd

I have strange behavior in the out put by just including the data type under the method change:, Can you please go below the code and tell me why it is happening so???

class Demo {
public static void main(String args[]){

A a = new A();
A b=a;

System.out.println(a.x);// 10 As expected
System.out.println(b.x);// 10 As expected

a.change();
System.out.println(a.x);// 10 WHY 10! still
System.out.println(b.x);// 10 WHY 10! still

}
}

class A {

int x=10;
public void change(){
int x=20; // I am delcaring this with int data type
}

}

pradeepkumarnm
Автор

Wrong information.... Change message to int type...it will also remain same...

mizanrifat
visit shbcf.ru