-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
377 lines (350 loc) · 13.1 KB
/
index.html
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Java CheatSheet</title>
<link rel="stylesheet" href="styelsheet.css">
</head>
<body>
<header>
<div class="container">
<div class="top">
<h3>Java Cheat Sheet</h3>
<input class="search-bar" id="searchbar" onkeyup="search_element()" type="text"
name="search" placeholder="Search .." >
</div>
<ul type="none">
<li>About Java</li>
<li>Learn</li>
<li>Download Cheat-Sheet</li>
</ul>
</div>
</header
<br><br>
<div class="contents">
<ol id='list'>
<li class="lists">
<div class="title" class="primitive-datatype">
<h3><u> Primitive data type</u></h3>
<div class="information">
<p>Primitive data types in java are <br>those data types which <br> are inbulit in the program and we can <br> derive other data types from it.<br>The various types osf datatypes are <br> given here. </p>
</div>
<table class="data-table" style="width:50%">
<tr class="table-head">
<th>Data Type</th>
<th>Size</th>
<th>Range</th>
</tr>
<tr>
<th>byte</th>
<th>8</th>
<th>-128 to 127</th>
</tr>
<tr>
<th>short</th>
<th>16</th>
<th>-32768 to 32767</th>
</tr>
<tr>
<th>int</th>
<th>32</th>
<th>-2147483648 to 2147483647</th>
</tr>
<tr>
<th>long</th>
<th>64</th>
<th>-9223372036854775808 to 9223372036854775807</th>
</tr>
<tr>
<th>float</th>
<th>32</th>
<th>3.4e-0.38 to 3.4e+0.38</th>
</tr>
<tr>
<th>double</th>
<th>64</th>
<th>1.7e-308 to 1.7e+308</th>
</tr>
<tr>
<th>char</th>
<th>16</th>
<th> complete unicode character set</th>
</tr>
<tr>
<th>Boolean</th>
<th> 1</th>
<th>True,False</th>
</tr>
</table>
</div>
</li>
<br><br>
<li class="lists">
<div class="title" class="operator">
<h3><u> Java Operators</u></h3>
<p> There are mainly 8 different types of operators in Java:</p>
<div class="information">Operators in Java are used to <br> check contions are see the queries are <br>true or false and also used to <br>improve functionality of code.</div>
<table class="data-table">
<tr class="table-head">
<th> Operator Type</th>
<th>Operators</th>
</tr>
<tr>
<th>Arithmatic</th>
<th>+,-,*,?,% </th>
</tr>
<tr>
<th>Assignment</th>
<th>=,+=,-=,*=,/=,%=,&=,^=,|=,<<=,>>=,>>>=</th>
</tr>
<tr>
<th>Bitwise</th>
<th>^,&,|</th>
</tr>
<tr>
<th>Logical</th>
<th>&&,||</th>
</tr>
<tr>
<th>Relational</th>
<th><,>,<=,>=,==,!=</th>
</tr>
<tr>
<th>Shift</th>
<th><<,>>,>>> </th>
</tr>
<tr>
<th>Ternary</th>
<th>?:</th>
</tr>
<tr>
<th>Unary</th>
<th>++x,-x,x++,x-,+x,-x,!</th>
</tr>
</table>
</div>
</li>
<br><br>
<li class="lists">
<div class="title" class="Java-IDE">
<h3><u>Java IDE and Executing Code</u></h3>
<p>Among many IDEs the most recommended ones are:
<ul>
<li>Eclipse</li>
<li>Netbeans</li>
</ul>
<p>Java code can be wriiten in any text editor and compiled and run on the terminal with following commands</p>
<p>$ javac [file_name].java</p>
<p>$java [file_name]</p>
<p><u><strong>Note:</strong></u>Filename should be same as the class name containing the main() method,with a .jav extention</p>
</div>
</li>
<br><br>
<li class="lists">
<div class="title" class="variables-in-java">
<h3><u>Variables in Java</u></h3>
<div class="information">
Variables in Java are used to manipulate the <br>values that are implicitly <br> or explicitly given <br> by the user or the system.
</div>
<table class="data-table">
<tr class="table-head">
<th> Local Variable</th>
<th> Global or Instance Variable</th>
<th>Static Variables</th>
</tr>
<tr>
<th>Declared and initialized inside the body of the method, block or constuctor.</th>
<th>Declared inside the class but outside of the method,block or constructor.If not initialised,the default value is 0.</th>
<th>Declared using a "static" keyword.It cannot be local.</th>
</tr>
<tr>
<th>It has acess only within the method in which it is declared and is destroyed later from the block or when the funtion call is returned.</th>
<th>Variables are created when an instance if the class is created and destroyed when it is destroyed.</th>
<th>Variables created creates a singlr copy in the memory which is shared among a;; objects at a class.</th>
</tr>
</table>
</div>
</li>
<br><br>
<li class="lists">
<div class="title" class="reserved-words">
<h3><u>Reserved words in Java</u></h3>
<p>Also known as <u>keywords</u>, are particular words which are predefined in Java and cannot be <br>used as variable or object name.Some of the importtant keywords are:</p>
<div class="information">These are the list of keywords which <br>cannot be used as variable names as <br>they serve different meaning and <br> functionality and the execution of Java code.</div>
<table class="data-table">
<br>
<tr class="table-head">
<th>Keywords</th>
<th>Usage</th>
</tr>
<tr>
<th>abstract</th>
<th>used to declare an abstract class.</th>
</tr>
<tr>
<th>catch</th>
<th>used to catch exceptions generated by try statements.</th>
</tr>
<tr>
<th>class</th>
<th>used to declare a class.</th>
</tr>
<tr>
<th>enum</th>
<th>defines a set of comatants.</th>
</tr>
<tr>
<th>extends</th>
<th>indicates the class is inherited.</th>
</tr>
<tr>
<th>final</th>
<th>inidcates the value cannot be changed.</th>
</tr>
<tr>
<th>finally</th>
<th>used to execute code after the try-catch structure.</th>
</tr>
<tr>
<th>implements</th>
<th>used to implement an interface.</th>
</tr>
<tr>
<th>new</th>
<th>used to create new objects.</th>
</tr>
<tr>
<th>static</th>
<th>used to indicate that a variable or a method is a class method.</th>
</tr>
<tr>
<th>super</th>
<th>used to refer to the parent class.</th>
</tr>
<tr>
<th>this</th>
<th>used to refer to he current object in a method or constructor.</th>
</tr>
<tr>
<th>throw</th>
<th>used to explicitly throw an exception.</th>
</tr>
<tr>
<th>throws</th>
<th>used to declare an exception.</th>
</tr>
<tr>
<th>try</th>
<th>block of code to handle an exception</th>
</tr>
</table>
</div>
</li>
<br><br>
<li class="lists">
<div class="title" class="methods-in-java">
<h3><u>Methods in Java</u></h3>
<div class="information">Methods in Java are used to build those <br>functions which are user defined <br> i.e they serve the funtionality <br> what the user wamts it to have.</div>
<p>The general form of method: <br><br>Where type- return type of method. <br>name-name of the mathod <br>parameter list-sequence of type and variables <br> seperated by a comma return-statement to <br>eturn value to calling routine <br>
</p>
<br>
<p><strong>Format:</strong></p>
<br>
<p>type name(parameter list)<br>
{<br>
//body of the method <br>
//return value(only id type is not void)<br>
<br>}
</p>
</div>
</li>
<br><br>
<li class="lists">
<div class="title" class="conditional-statemnts-in-java">
<h3><u>Conditional Statements in Java</u></h3>
<div class="information">Condtional statemnets are used to check <br>some contraints that help the user to <br>get btter results based on the bifercation.</div>
<ul>
<li>if-else
<p>Tests condition,if true condition block is excuted otherwise else block is executed</p>
<br>
<p>Example</p>
<a href="if.png"><img src="if.png"></a>
<br><br>
</li>
<li>Switch
<p>Test the condition, if a particular case is true the control is passed to the block and <br> executed.The rest of the cases are not considered further and the program braks out of the loop.</p>
<br>
<p>Example:</p>
<a href="switch.png"><img src="switch.png"></a>
<br><br>
</li>
</ul>
</div>
</li>
<br><br>
<li class="lists">
<div class="title" class="Loops">
<h3><u>Loops in Java</u></h3>
<div class="information">
<p>Loops are used to iterate the code <br> a specific number of times until the <br>specified condition is true,<br>There are three kinds of loops on Java:</p>
</div>
<table class="data-table">
<tr class="table-head">
<th>For loop</th>
<th></th>
</tr>
<tr>
<th>Iterates the code for a specific number of times until the condition is true.</th>
<th>class TestforLoop{<br>public static void main(String[] args){<br>for(int i=0;i<=10;i++){<br>System.out.print(i);<br>}<br>}<br>}</th>
</tr>
<tr class="table-head">
<th>while loop</th>
<th></th>
</tr>
<tr>
<th>If the condition in the while is true the program enters the loop for iteration.</th>
<th>{public static void main(String[] args){<br>int i=1;<br>while(i<=10)<br>{<br>Sytem.out.println(i);<br>i++;<br>}<br>}</th>
</tr>
<tr class="table-head">
<th>do-while loop</th>
<th></th>
</tr>
<tr>
<th>The program enter s the loop for iteration at least once irrespective of the while condition being true,For further iterations,it depemds o nthe while comdition to be true.</th>
<th>class TestDoWhile{<br>public static void main(String[] args){<br>int i=1;<br>do{<br>Sytem.out.println(i);<br>i++;<br>}while(i<=10);<br>}<br>}</th>
</tr>
</table>
</div>
</li>
<br><br>
<li class="lists">
<div class="title" class="arrays">
<h3><u>Arrays</u></h3>
<div class="information">
<p>Array is a group of like-type variables <br> that are referred by a common name,<br> having continuous memory. Primitive values <br> or objects can be stored in an array.<br> It provides code optimization since we can <br> sort data efficiently and also access it randomly. <br>The only flaw is that we can have a <br>fixed-size elements in an array.
</div>
<p>There are Two kinnds of arrays defined in Java:<br>
<ul>
<li>Single Dimentional:Elements are stored in a single row.<br>
<div class="image">
<br>
<a href="1d.png"><img src="1d.png"></a>
</div>
<li>Mutli Dimentional:Elements are stored as row and column.<br>
<div class="image">
<br>
<a href="2d.png"><img src="2d.png"></a>
</div>
</li>
</ul>
</p>
</div>
</li>
</ol>
</div>
<script src="./script.js"></script>
</body>
<footer>
<h3><center>Happy Coding!!!<center></h3>
</footer>
</html>