Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have studied about java datatype very earlier and found that they are primitive type. As java is object oriented but its data types are not. why is it so?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.9k views
Welcome To Ask or Share your Answers For Others

1 Answer

It is said that everything in Java is an Object at the same time the Java Programming Language is meant to be simple. Since the primitive data types consume less memory and can be accessed faster, they are not objects. The equivalent Wrapper classes are also available in java like "Integer" "Short" etc. They can be used as objects if you want. However, the wrapper classes will be stored in Heap and they are slow.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...