-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathown java documentation by me
216 lines (101 loc) · 5.69 KB
/
own java documentation by me
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
Java:
1.java is mainly used for "application programming".
where as c++ is used for the "system programming".
2.Java does not support "goto" statement.
where as in c++ supports goto statement.
3.Java does not support multiple inheritance you can achieve through the interfaces in java
in c++ supports multiple inheritance.
4.java support pointer internally.you can't write pointer program in java.
in c++ supports pointers.
5.Java doesn't support operator overloading
c++ support operator overloading
6.java uses both compiler and interpreter
Java source code is converted into bytecode at compilation time.
the interpreter executes this bytecode at runtime and produces output.
Java is interpreted that is why it is platform independent.
7.Java supports call by value only . There is no call by reference in java.
in c++ supports both call by vlaue and call by reference.
8.Java does not support structures and unions.
c++ supports structures and unions.
9.Java has built in thread support.
c++ does not support thread.
10.Java support documentation comment (/** .........*/) to create documentation for java source code.
C++ doesn't support documentation comment.
11.Java has no virtual keyword.we can override all non-static methods by default.
12.unsigned right shift(>>>)
java support unsigned right shift.that fills zero at the top for the negative numbers.
for positive numbers it works same like >> operator
13. Java is not so interactive with hardware.
c++ is nearer to hardware
14. Java does not support header files like C++.
Java uses the import keyword to include different classes and methods.
---------------------------------------------------------------------------------------------------------------------------------------
1. Having a semicolon at the end of class is optional in Java.
class A{
static public void main(String... args)
{
System.out.println("hello java4");
}
};
2) java valid main method signature
public static void main(String[] args)
public static void main(String []args)
public static void main(String args[])
public static void main(String... args)
static public void main(String[] args)
public static final void main(String[] args)
final public static void main(String[] args)
final strictfp public static void main(String[] args)
3)Java INVALID main method signature.
public void main(String[] args)
static void main(String[] args)
public void static main(String[] args)
abstract public static void main(String[] args)
4)jvm -java virtual machine
jre -java runtime environment
jdk -java developmentk it
what does jvm does?
The JVM performs following operation:
Loads code
Verifies code
Executes code
Provides runtime environment
5) JVM ARCHITECTURE
1.class loader
Classloader is a subsystem of JVM which is used to load class files. Whenever we run the java program,
it is loaded first by the classloader. There are three built-in classloaders in Java.
->Bootstrap ClassLoader:
This is the first classloader which is the super class of Extension classloader.
It loads the rt.jar file which contains all class files of Java Standard Edition like java.lang package classes,
java.net package classes,
java.util package classes, java.io package classes, java.sql package classes etc.
->Extension ClassLoader:
This is the child classloader of Bootstrap and parent classloader of System classloader.
It loades the jar files located inside $JAVA_HOME/jre/lib/ext directory.
System/Application ClassLoader:
This is the child classloader of Extension classloader.
It loads the classfiles from classpath. By default, classpath is set to current directory.
You can change the classpath using "-cp" or "-classpath" switch.
It is also known as Application classloader.
-------------------------------------------------------------------------------------------------------------------------------------
Java variables
There are three types of variables
1.local variables.
2.instance variables
3. Static variables.
1.LOCAL Variables.
declare inside a method.
2.INSTANCE Variables
menas that we can declare inside class but outside of the method.
3.STATIC Variable.
variable that can be declared as static .it can not be local variavle
example for the variable declarations.
class A{
int data=50;//instance variable
static int m=100;//static variable
void method()
{
int n=90;//local variable
}
}//end of class
--------------------------------------------------------------------------------------------------------------------------