mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-09 16:26:53 +02:00
Update java.html.markdown
This commit is contained in:
@@ -97,7 +97,7 @@ Read more here: https://en.wikipedia.org/wiki/Java_(programming_language)
|
|||||||
array[1] = 1;
|
array[1] = 1;
|
||||||
System.out.println(array[1]); // => 1
|
System.out.println(array[1]); // => 1
|
||||||
array[1] = 2;
|
array[1] = 2;
|
||||||
printf("%d\n", my_array[1]); // => 2
|
System.out.println(array[1]); // => 2
|
||||||
|
|
||||||
//Others to check out
|
//Others to check out
|
||||||
//ArrayLists - Like arrays except more functionality is offered, and the size is mutable
|
//ArrayLists - Like arrays except more functionality is offered, and the size is mutable
|
||||||
@@ -139,10 +139,10 @@ Read more here: https://en.wikipedia.org/wiki/Java_(programming_language)
|
|||||||
|
|
||||||
// Incrementations
|
// Incrementations
|
||||||
int i=0;
|
int i=0;
|
||||||
i++; //i = 1. Post Incrementation
|
i++; //i = 1. Post-Incrementation
|
||||||
++i; //i = 2. Pre Incrementation
|
++i; //i = 2. Pre-Incrementation
|
||||||
i--; //i = 1. Post Decrementation
|
i--; //i = 1. Post-Decrementation
|
||||||
--i; //i = 0. Pre Decrementation
|
--i; //i = 0. Pre-Decrementation
|
||||||
|
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
// Control Structures
|
// Control Structures
|
||||||
@@ -288,13 +288,13 @@ Read more here: https://en.wikipedia.org/wiki/Java_(programming_language)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Now..Later in the main / driver of your java program
|
//Now..Later in the main / driver of your java program
|
||||||
|
|
||||||
public class Main
|
public class Main
|
||||||
{
|
{
|
||||||
public static void main (String[] args) throws java.lang.Exception
|
public static void main (String[] args) throws java.lang.Exception
|
||||||
{
|
{
|
||||||
//Call bicycle's constructor
|
//Call bicycle's constructor
|
||||||
Bicycle trek = new Bicycle();
|
Bicycle trek = new Bicycle();
|
||||||
|
//Manipulate your object
|
||||||
trek.speedUp(3);
|
trek.speedUp(3);
|
||||||
trek.setCadence(100);
|
trek.setCadence(100);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user