Skip to main content

Posts

Wrapper class ,auto boxing and unboxing in Java

#Topic-6 Previous topic (5) we have discussed about Variables and Data Types in Java, we have gone through various data types and literals. If you have not gone through that topic, click this link What are the Variables and Data types using in Java? In this section we will discuss about Wrapper class, auto-boxing, UN-boxing and many more! Wrapper class in Java Each of Java's eight primitive data types has a class dedicated to it. These are known as wrapper classes because they "wrap" the primitive data type into an object of that class. The wrapper classes are part of the java.lang package, which is imported by default into all Java programs.  Wrapper class in java are the Object representation of eight primitive types in java. All the wrapper classes in java are  immutable and final. Java  auto boxing and UN-boxing allows easy conversion between primitive types and their corresponding wrapper classes in java programs.All the wrapper classes (Integer, ...

Variables and Data Types in Java

#Topic-5 Previous topic (4) we have discussed about how to start coding! , we have gone through our first Java Program line by line. If you have not gone through that topic, click this link  Your First Java Program: Hello World In this section we will discuss about variable , Data types , Literals and many more! Variable Variable is name of reserved area allocated in memory . In other words, it is a name of memory location . It is a combination of "vary + able" that means its value can be changed.   Example:   int value= 10 ; //Here value is variable float a= 10.50 ; //Here a is variable   There are three major types of variables in java: local variable instance variable static variable 1) Local Variable : A variable which is declared inside the method is called local variable. 2) Instance Variable : A variable which is declared inside the class but outside the method, is called instance variable . It is not declare...