Cheatography
https://cheatography.com
Java Databyte | 8 bits | short | 16 bits | int | 32 bits | long | 64 bits | boolean | bit | char | 16 bit unicode | float | 32 bit unicode | double | 64 bit unicode |
Swappingpublic static void swap(int[] list, int e1, int e2) {
int[] mylist = {1, 2, 3, 4, 5};
int[] mylist2 = new int[9];
int temp;
temp = mylist[e1];
mylist2[e2] = mylist[e1];
mylist2[e2] = temp;
for (int i : mylist){
System.out.println(i);
}
|
CharChar is same with string but char for only letter!!
String letter = "A"; |
| | String and ArraysString
String name = "Whatever you want"
Array
Array[0] = 1
Array[1] = 2
Array[2] = 3
|
Make the class1.Click Src
2.Click New
3.Java Class
4. Insert name
5. Type the code down
|
Some trickSwitch tabs | Ctrl-Tab | Previous/Next tab | Alt-Left/Right | Back/Forward in code | Ctrl-Alt-Left/Right | Last edit location | Ctrl-Shift-Backspace |
While loopWhile loops
int count = 0;
while (count < mylist.lenght) {
System.out.print( mylist[count] + "");
count ++;
|
| | Some code/n = new line
/t = tap
/" = "
/* = multiple
// = /
|
For Loopwhile loop
int x = 1;
while (x < 10) {
System.out.println(x);
x++;
for loop
for (int a = 0; a < 10; a++){
System.out.println(a);
Enchanted for loop
int number[] = { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
for (int a: number) {
System.out.println(a);
while..do loop
int x = 1;
do{
System.out.println( x );
x++;
}
while( x < 10 );
|
|
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets