Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathWrapperClass.java
More file actions
Latest commit
59 lines (51 loc) · 1.58 KB
/
Copy pathWrapperClass.java
File metadata and controls
59 lines (51 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
Java is not 100% OOP because it can have primitive type variables like int float etc
but wrappper class gives a solution. instead of creating primitive variables. we can store our
data into wrapper classes.
for eg
Integer is a wrapper class which stores int values . But since Integer is a class not primitive variabele
hence we can say that now every things is object
*/
packagewrapper.pkgclass;
publicclassWrapperClass {
publicstaticvoidmain(String[] args) {
// static function present in each wraper class
// takes input as integer and saves as integer
// return reference of Integer class
Integerin= Integer.valueOf("88");
//similary
Floatf=Float.valueOf("5.55");
//static funtion to convert string to corresponding types
inti=Integer.parseInt("22");
//similarly
doubled=Double.parseDouble("4.3");
//instance function that returns value stored in Integer class
inta =in.intValue();
}
}
classWrapperclass
{
publicstaticvoidmain(Stringargs[])
{
// static function present in each wraper class
Stringa="123";
Integeri=Integer.parseInt(a); //creating a wrapper class object
//this will convert the string into the corresponding type
if(a.equals("123"))
{
System.out.println("Equals");
}
else
{
System.out.println("Not equals");
}
if(i==(123))
{
System.out.println("Print");
}
else
{
System.out.println("Not Print");
}
}
}