Update 'README.md'

main
mahuntington 3 weeks ago
parent 6df37f4273
commit 715a92b3c5

@ -2,81 +2,76 @@
```java ```java
class HelloWorld{ class HelloWorld{
void main(String[] args){
void printMessage() { System.out.println("Hello, Matt");
System.out.println("Hi");
} }
int add(int a, int b){
return a + b;
} }
```
void main(String[] args){ ```java
//System.out.println("Hello, Matt");
String greeting = "Hello there!"; String greeting = "Hello there!";
```
```java
int myAge = 46; int myAge = 46;
int myNewAge = myAge + 2; int myNewAge = myAge + 2;
```
```java
double myWeight = 144.5; double myWeight = 144.5;
//System.out.println(myWeight); ```
```java
Boolean isCool = false; Boolean isCool = false;
if(isCool){ if(isCool){
//System.out.println("Welcome to the party"); System.out.println("Welcome to the party");
} else { } else {
//System.out.println("Get lost dweeeeeeb"); System.out.println("Get lost dweeeeeeb");
} }
```
```java
int myAge = 46;
while(myAge < 50){ while(myAge < 50){
//System.out.println(myAge); System.out.println(myAge);
myAge++; myAge++;
} }
```
```java
for(int i = 0; i < 5; i++){ for(int i = 0; i < 5; i++){
//System.out.println(i); System.out.println(i);
} }
```
```java
String[] cars = {"Volvo", "Toyota", "Mazda"}; String[] cars = {"Volvo", "Toyota", "Mazda"};
//System.out.println(cars[1]); System.out.println(cars[1]);
```
//printMessage();
int result = add(4, 2);
//System.out.println(result);
Human matt = new Human("Matthew");
System.out.println(matt.name);
SuperHuman superman = new SuperHuman("Clark", "flight");
superman.name = "bilbo";
System.out.println(superman.name);
//superman.power = "burping";
System.out.println(superman.getPower());
Sedan myCar = new Sedan(); ```java
myCar.drive(); class HelloWorld{
myCar.stop();
Swallow stewart = new Swallow(); void printMessage() {
stewart.fly(); System.out.println("Hi");
} }
void main(String[] args){
printMessage();
}
} }
``` ```
```java ```java
interface Bird { class HelloWorld{
void fly();
int add(int a, int b){
return a + b;
} }
```
```java void main(String[] args){
abstract class Car { int result = add(4, 2);
abstract void drive(); System.out.println(result);
void stop(){
System.out.println("screeeeech");
} }
} }
``` ```
@ -88,12 +83,11 @@ class Human {
this.name = name; this.name = name;
} }
} }
```
```java class HelloWorld{
class Sedan extends Car{ void main(String[] args){
void drive(){ Human matt = new Human("Matthew");
System.out.println("vroom"); System.out.println(matt.name);
} }
} }
``` ```
@ -109,12 +103,56 @@ class SuperHuman extends Human {
return this.power; return this.power;
} }
} }
class HelloWorld{
void main(String[] args){
SuperHuman superman = new SuperHuman("Clark", "flight");
superman.name = "bilbo";
System.out.println(superman.name);
//superman.power = "burping";
System.out.println(superman.getPower());
}
}
```
```java
abstract class Car {
abstract void drive();
void stop(){
System.out.println("screeeeech");
}
}
class Sedan extends Car{
void drive(){
System.out.println("vroom");
}
}
class HelloWorld{
void main(String[] args){
Sedan myCar = new Sedan();
myCar.drive();
myCar.stop();
}
}
``` ```
```java ```java
interface Bird {
void fly();
}
class Swallow implements Bird { class Swallow implements Bird {
public void fly() { public void fly() {
System.out.println("sweeeee"); System.out.println("sweeeee");
} }
} }
class HelloWorld{
void main(String[] args){
Swallow stewart = new Swallow();
stewart.fly();
}
}
``` ```
Loading…
Cancel
Save