The wrapper classes in Java are used to convert primitive data types like int and float into objects. There are eight wrapper classes that correspond to the eight primitive types. Wrapper classes allow primitive types to be used in contexts that require objects, like collections. They provide methods to convert between primitive types and their corresponding wrapper class objects.
Java abstract class & abstract methods,Abstract class in java
Abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, but contains no implementation. Abstract classes may not be instantiated, and require subclasses to provide implementations for the abstract methods.
Java abstract class & abstract methods,Abstract class in java
Abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, but contains no implementation. Abstract classes may not be instantiated, and require subclasses to provide implementations for the abstract methods.
oops concept in java | object oriented programming in javaCPD INDIA
object oriented programming is a key concept for the development of application in windows as well as web based application environment. oops concept maps real world through its concept of classes, objects, inheritance, polymorphism which help in making a robust application.
This ppt gives a general idea about the multithreading concepts in the java programming language. hope you find it useful
P.S :
sorry there is a correction in one of the slides
where i have entered implements thread
it is wrong it is actually implements Runnable
thank you!
In the Java programming language, the final keyword is used in several different contexts to define an entity that can only be assigned once. Once a final variable has been assigned, it always contains the same value.
This keyword is a reference variable that refer the current object in java.
This keyword can be used for call current class constructor.
http://www.tutorial4us.com/java/java-this-keyword
Mumbai Academics is Mumbai’s first dedicated Professional Training Center for Training with Spoke and hub model with Multiple verticles . The strong foundation of Mumbai Academics is laid by highly skilled and trained Professionals, carrying mission to provide industry level input to the freshers and highly skilled and trained Software Professionals/other professional to IT companies.
oops concept in java | object oriented programming in javaCPD INDIA
object oriented programming is a key concept for the development of application in windows as well as web based application environment. oops concept maps real world through its concept of classes, objects, inheritance, polymorphism which help in making a robust application.
This ppt gives a general idea about the multithreading concepts in the java programming language. hope you find it useful
P.S :
sorry there is a correction in one of the slides
where i have entered implements thread
it is wrong it is actually implements Runnable
thank you!
In the Java programming language, the final keyword is used in several different contexts to define an entity that can only be assigned once. Once a final variable has been assigned, it always contains the same value.
This keyword is a reference variable that refer the current object in java.
This keyword can be used for call current class constructor.
http://www.tutorial4us.com/java/java-this-keyword
Mumbai Academics is Mumbai’s first dedicated Professional Training Center for Training with Spoke and hub model with Multiple verticles . The strong foundation of Mumbai Academics is laid by highly skilled and trained Professionals, carrying mission to provide industry level input to the freshers and highly skilled and trained Software Professionals/other professional to IT companies.
Woxa Technologies have great industrial exoerts in java field they work on the live projects with students they are not teacher they are industrial trainer.
for more information 8471003400
ZeroSpace is a part of Woxa Technology where industrial trainer are ready to trained you.Take a demo class and choose your future in the programming field. We offer to learn in latest technology with live project which is demanding.
feel free to contact us-: 8471003400
Synapse India Reviews About:
Functional/procedural programming:
program is a list of instructions to the computer
Object-oriented programming
program is composed of a collection objects that communicate with each other
Java , basics of java programming, JVM, JRE, JDK detailed explanation. primitive datatype. this ppt explains the basic concepts of java clearly starting from variables to complex programmes. It has 55 slides which gives you better understanding
The application layer sits at Layer 7, the top of the Open Systems Interconnection (OSI) communications model. It ensures an application can effectively communicate with other applications on different computer systems and networks. The application layer is not an application.
Saudi Arabia stands as a titan in the global energy landscape, renowned for its abundant oil and gas resources. It's the largest exporter of petroleum and holds some of the world's most significant reserves. Let's delve into the top 10 oil and gas projects shaping Saudi Arabia's energy future in 2024.
Welcome to WIPAC Monthly the magazine brought to you by the LinkedIn Group Water Industry Process Automation & Control.
In this month's edition, along with this month's industry news to celebrate the 13 years since the group was created we have articles including
A case study of the used of Advanced Process Control at the Wastewater Treatment works at Lleida in Spain
A look back on an article on smart wastewater networks in order to see how the industry has measured up in the interim around the adoption of Digital Transformation in the Water Industry.
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)MdTanvirMahtab2
This presentation is about the working procedure of Shahjalal Fertilizer Company Limited (SFCL). A Govt. owned Company of Bangladesh Chemical Industries Corporation under Ministry of Industries.
Overview of the fundamental roles in Hydropower generation and the components involved in wider Electrical Engineering.
This paper presents the design and construction of hydroelectric dams from the hydrologist’s survey of the valley before construction, all aspects and involved disciplines, fluid dynamics, structural engineering, generation and mains frequency regulation to the very transmission of power through the network in the United Kingdom.
Author: Robbie Edward Sayers
Collaborators and co editors: Charlie Sims and Connor Healey.
(C) 2024 Robbie E. Sayers
1. Java Wrapper Classes
Handled By
Dr.T.Abirami
Associate Professor
Department of IT
Kongu Engineering College Perundurai
2. Wrapper classes
• The wrapper classes in Java are used to
convert primitive types (int, char, float, etc)
into corresponding objects.
3. Need for Wrapper Classes
• Generic classes only work with objects and
don't support primitives.
• Data structures in the Collection framework such
as ArrayList and Vector store only the objects
(reference types) and not the primitive types.
• The object is needed to
support synchronization in multithreading.
4. Importance of Wrapper classes
There are mainly two uses with wrapper classes.
1) To convert simple data types into objects,
that is, to give object form to a data type; here
constructors are used.
2) To convert strings into data types (known as
parsing operations), here methods of type
parseYYY () are used. YYY->datatypes
5. Features of the Java wrapper Classes.
1) Wrapper classes convert numeric strings into
numeric values.
2) The way to store primitive data in an object.
3) The valueOf() method is available in all
wrapper classes except Character
4) All wrapper classes have datatypeValue()
method. This method returns the value of the
object as its primitive type.
6. Wrapper Classes
• To convert primitive data type into object and
object into primitive.
• The automatic conversion of primitive into an
object is known as autoboxing
• objects into primitives automatically is called
unboxing
7. • The eight classes of the java.lang package are
known as wrapper classes in Java.
• The list of eight wrapper classes are given
below:
Wrapper Classes
Primitive Type Wrapper class
boolean Boolean
char Character
byte Byte
short Short
int Integer
long Long
float Float
double Double
8. Creating Wrapper Objects
public class MyClass {
public static void main(String[] args) {
Integer myInt = 5;
Double myDouble = 5.99;
Character myChar = 'A';
System.out.println(myInt);
System.out.println(myDouble);
System.out.println(myChar);
}
}
9. • valueOf() method : To create Wrapper object
for given primitive data type or String.
• parseInt() ,parseFloat(), parseDouble()
method : to convert String class (Wrapper
class) to primitive
methods of Wrapper classes
10. methods of Wrapper classes
Method Purpose
parseInt(s) returns a signed decimal integer value equivalent to string s
toString(i) returns a new String object representing the integer i
byteValue() returns the value of this Integer as a byte
doubleValue() returns the value of this Integer as a double
floatValue() returns the value of this Integer as a float
intValue() returns the value of this Integer as an int
shortValue() returns the value of this Integer as a short
longValue() returns the value of this Integer as a long
11. Creating Wrapper Objects
public class MyClass {
public static void main(String[] args) {
Integer myInt = 5;
Double myDouble = 5.99;
Character myChar = 'A';
System.out.println(myInt);
System.out.println(myDouble);
System.out.println(myChar);
}
}
12. Convert Wrapper class into Primitive
data types
public class MyClass {
public static void main(String[] args) {
Integer myInt = 5;
Double myDouble = 5.99;
Character myChar = 'A';
System.out.println(myInt.intValue());
System.out.println(myDouble.doubleValue());
System.out.println(myChar.charValue());
}
}
13. autoboxing
public class AutoBoxingTest
{
public static void main(String args[])
{
int num = 10; // int primitive
Integer obj = Integer.valueOf(num);
// creating a wrapper class object
System.out.println(num + " " + obj);
}
}
14. Unboxing
public class UnboxingTest
{
public static void main(String args[]) {
Integer obj = new Integer(10);
// Creating Wrapper class object
int num = obj.intValue();
// Converting the wrapper object to primitive datatype
System.out.println(num + " " + obj);
}
}
15. Primitive data type to Wrapper class
//Autoboxing example of int to Integer
class WrapperExample1{
public static void main(String args[]){
//Converting int into Integer
int a=20;
Integer i=Integer.valueOf(a);
//converting int into Integer explicitly
Integer j=a;
//autoboxing, now compiler will write Integer.valueOf(a) internally
System.out.println(a+" "+i+" "+j);
}}
16. Wrapper class to Primitive data type
//Unboxing example of Integer to int
class WrapperExample2{
public static void main(String args[]){
//Converting Integer to int
Integer a=new Integer(3);
int i=a.intValue();
//converting Integer to int explicitly
System.out.println(a+" "+i);
}}
17. toString()
// Java program to illustrate toString()
class GFG {
public static void main(String[] args)
{
Integer I = new Integer(10);
String s = I.toString();
System.out.println(s);
}
}