-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDataMember_Initialization.java
More file actions
75 lines (50 loc) · 1.31 KB
/
DataMember_Initialization.java
File metadata and controls
75 lines (50 loc) · 1.31 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import java.util.*;
public class DataMember_Initialization{
public static void main(String[] args){
// Add a = new Add();
// System.out.println(a.sum(10,20,30));
// System.out.println(a.sum(12,12));
// System.out.println(a.sum(33));
// System.out.println(a.sum());
// System.out.println(a instanceof Add);
byte arr[] = {66,65,67,68,69};
char carr[]={65,66,67,68,69,70};
StringBuffer sb = new StringBuffer("StringBuffer Object!");
String s = new String(arr);
String s1 = new String(carr);
System.out.println(s1);
String s2 = new String(sb);
System.out.println(s2);
String s4 = "StringBuffer Object!AADITYA!";
String s3 = s2.concat("AADITYA!");
System.out.println(s3);
System.out.println(s3.length());
System.out.println(s3.charAt(3));
System.out.println(s3.equals(s4));
byte b[];
b = s3.getBytes();
for(int i=0; i<b.length; i++){
System.out.print(b[i]+" ");
}
System.out.println();
StringBuffer sb1 = new StringBuffer(5);
System.out.println("Capacity = "+sb1.capacity());
}
}
class Add{
private int a;
private int b;
private int c;
public int sum(int n1, int n2, int n3){
return n1+n2+n3;
}
public int sum(int n1, int n2){
return n1+n2;
}
public int sum(int n1){
return n1;
}
public String sum(){
return "Nothing is Provided!";
}
}