filmov
tv
Java Chapter 7 ES 19

Показать описание
29/11/2024
========
Chapter – 7
=========
• Packages
• Wrapper Classes
• Exception Handling
Packages
=======
group of related classes and interface and, sub-packages coding to theire functionality
Type of the package in java
====================
2 types of package
1 pre defined package(inbuilt)
2 user defined package
without import the package
import package with specified class
import package with all class
Static import
============
1.5
=======================================================
Wrapper Classes
=============
wrapper class convert primitive data type into object and object int primitive type
java 5
autobaxing : primitive to object
autounboxing : object primitive
primitive
=======
boolean
char
byte
short
int
long
float
double
wrapper
======
Boolean
Character
Byte
Short
Integer
Long
Float
Double
==========
Byte b = new Byte(byte);
Byte b = new Byte(String);
Methods
========
valueOf() p-o
primitivetype xxValue() o-p
static primitivetype parse xxx(String)
public class WapperDemo {
public static void main(String[] args) {
Integer a, b;
//a = new Integer(10);
a = 10; //auto boxing
b = 20; //auto boxing
int d = a + b;//auto unboxing
}
}
===========================
public class StaticImportDemo {
public static void main(String[] args) {
}
}
===================================
public class ImportDemo {
public static void main(String[] args) {
int[] arr = {10,3,5,8,0,19};
}
}
========
Chapter – 7
=========
• Packages
• Wrapper Classes
• Exception Handling
Packages
=======
group of related classes and interface and, sub-packages coding to theire functionality
Type of the package in java
====================
2 types of package
1 pre defined package(inbuilt)
2 user defined package
without import the package
import package with specified class
import package with all class
Static import
============
1.5
=======================================================
Wrapper Classes
=============
wrapper class convert primitive data type into object and object int primitive type
java 5
autobaxing : primitive to object
autounboxing : object primitive
primitive
=======
boolean
char
byte
short
int
long
float
double
wrapper
======
Boolean
Character
Byte
Short
Integer
Long
Float
Double
==========
Byte b = new Byte(byte);
Byte b = new Byte(String);
Methods
========
valueOf() p-o
primitivetype xxValue() o-p
static primitivetype parse xxx(String)
public class WapperDemo {
public static void main(String[] args) {
Integer a, b;
//a = new Integer(10);
a = 10; //auto boxing
b = 20; //auto boxing
int d = a + b;//auto unboxing
}
}
===========================
public class StaticImportDemo {
public static void main(String[] args) {
}
}
===================================
public class ImportDemo {
public static void main(String[] args) {
int[] arr = {10,3,5,8,0,19};
}
}