Update 'README.md'

main
mahuntington 3 weeks ago
parent 6df37f4273
commit 715a92b3c5

@ -2,81 +2,76 @@
```java ```java
class HelloWorld{ class HelloWorld{
void printMessage() {
System.out.println("Hi");
}
int add(int a, int b){
return a + b;
}
void main(String[] args){ void main(String[] args){
System.out.println("Hello, Matt");
//System.out.println("Hello, Matt");
String greeting = "Hello there!";
int myAge = 46;
int myNewAge = myAge + 2;
double myWeight = 144.5;
//System.out.println(myWeight);
Boolean isCool = false;
if(isCool){
//System.out.println("Welcome to the party");
} else {
//System.out.println("Get lost dweeeeeeb");
} }
}
```
while(myAge < 50){ ```java
//System.out.println(myAge); String greeting = "Hello there!";
myAge++; ```
}
for(int i = 0; i < 5; i++){ ```java
//System.out.println(i); int myAge = 46;
} int myNewAge = myAge + 2;
```
String[] cars = {"Volvo", "Toyota", "Mazda"}; ```java
//System.out.println(cars[1]); double myWeight = 144.5;
```
//printMessage(); ```java
Boolean isCool = false;
if(isCool){
System.out.println("Welcome to the party");
} else {
System.out.println("Get lost dweeeeeeb");
}
```
int result = add(4, 2); ```java
//System.out.println(result); int myAge = 46;
while(myAge < 50){
System.out.println(myAge);
myAge++;
}
```
Human matt = new Human("Matthew"); ```java
System.out.println(matt.name); for(int i = 0; i < 5; i++){
System.out.println(i);
}
```
SuperHuman superman = new SuperHuman("Clark", "flight"); ```java
superman.name = "bilbo"; String[] cars = {"Volvo", "Toyota", "Mazda"};
System.out.println(superman.name); System.out.println(cars[1]);
//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();
}
```
```java int add(int a, int b){
abstract class Car { return a + b;
abstract void drive(); }
void stop(){
System.out.println("screeeeech"); void main(String[] args){
int result = add(4, 2);
System.out.println(result);
} }
} }
``` ```
@ -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