|
byte
|
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
|
public 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);
}
String
String name = "Whatever you want"
Array
Array[0] = 1
Array[1] = 2
Array[2] = 3
1.Click Src
2.Click New
3.Java Class
4. Insert name
5. Type the code down
|
Switch tabs
|
Ctrl-Tab
|
|
Previous/Next tab
|
Alt-Left/Right
|
|
Back/Forward in code
|
Ctrl-Alt-Left/Right
|
|
Last edit location
|
Ctrl-Shift-Backspace
|
While loops
int count = 0;
while (count < mylist.lenght) {
System.out.print( mylist[count] + "");
count ++;
/n = new line
/t = tap
/" = "
/* = multiple
// = /
while 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 );
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.