└── Core
├── BankAccountBalance
├── .classpath
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
├── bin
│ └── bankaccount
│ │ ├── BankAccount.class
│ │ ├── InSufficientFundException.class
│ │ └── Test.class
└── src
│ └── bankaccount
│ ├── BankAccount.java
│ ├── InSufficientFundException.java
│ └── Test.java
├── Calculator
├── .classpath
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
├── bin
│ └── calculator
│ │ └── Calculator.class
└── src
│ └── calculator
│ └── Calculator.java
├── EnumTrafficLight
├── .classpath
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
├── bin
│ └── trafficlight
│ │ ├── Baaaa.class
│ │ ├── TrafficLight.class
│ │ └── TrafficLightTest.class
└── src
│ └── trafficlight
│ ├── Baaaa.java
│ ├── TrafficLight.java
│ └── TrafficLightTest.java
├── ExceptionHandling
├── .classpath
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
├── bin
│ └── exception
│ │ ├── ExceptionHandling.class
│ │ ├── ThrowException.class
│ │ ├── ThrowableMethod.class
│ │ └── ThrowsException.class
└── src
│ └── exception
│ ├── ExceptionHandling.java
│ ├── ThrowException.java
│ ├── ThrowableMethod.java
│ └── ThrowsException.java
├── Exercise
├── .classpath
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
├── bin
│ ├── array
│ │ └── Array.class
│ ├── boxing
│ │ └── AutoBoxingUnBoxing.class
│ ├── branching
│ │ ├── BreakStatement.class
│ │ ├── ContinueStatement.class
│ │ └── ReturnStatement.class
│ ├── comment
│ │ └── Comment.class
│ ├── datatype
│ │ ├── DataType.class
│ │ └── TypeCasting.class
│ ├── decisionmaking
│ │ ├── IfElseStatement.class
│ │ ├── IfLadderNestedIfStatement.class
│ │ └── SwitchCaseStatement.class
│ ├── enumtype
│ │ ├── Color.class
│ │ └── ColorTest.class
│ ├── inputoutput
│ │ ├── BasicInput.class
│ │ └── BasicOutput.class
│ ├── loop
│ │ ├── DoWhileLoop.class
│ │ ├── ForEachLoop.class
│ │ ├── ForLoop.class
│ │ └── WhileLoop.class
│ ├── method
│ │ ├── MethodExample.class
│ │ └── MethodOverloading.class
│ ├── operator
│ │ ├── ArithmeticOperator.class
│ │ ├── AssignmentOperator.class
│ │ ├── ConditionalOperator.class
│ │ ├── EqualityRelationalOperator.class
│ │ ├── OperatorPresedence.class
│ │ └── UnaryOperator.class
│ ├── swing
│ │ └── SwingExample.class
│ └── variable
│ │ └── Variable.class
└── src
│ ├── array
│ └── Array.java
│ ├── boxing
│ └── AutoBoxingUnBoxing.java
│ ├── branching
│ ├── BreakStatement.java
│ ├── ContinueStatement.java
│ └── ReturnStatement.java
│ ├── comment
│ └── Comment.java
│ ├── datatype
│ ├── DataType.java
│ └── TypeCasting.java
│ ├── decisionmaking
│ ├── IfElseStatement.java
│ ├── IfLadderNestedIfStatement.java
│ └── SwitchCaseStatement.java
│ ├── enumtype
│ ├── Color.java
│ └── ColorTest.java
│ ├── inputoutput
│ ├── BasicInput.java
│ └── BasicOutput.java
│ ├── loop
│ ├── DoWhileLoop.java
│ ├── ForEachLoop.java
│ ├── ForLoop.java
│ └── WhileLoop.java
│ ├── method
│ ├── MethodExample.java
│ └── MethodOverloading.java
│ ├── operator
│ ├── ArithmeticOperator.java
│ ├── AssignmentOperator.java
│ ├── ConditionalOperator.java
│ ├── EqualityRelationalOperator.java
│ ├── OperatorPresedence.java
│ └── UnaryOperator.java
│ ├── swing
│ └── SwingExample.java
│ └── variable
│ └── Variable.java
├── ExponentialNumber
├── .classpath
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
├── bin
│ └── exponential
│ │ └── ExponentialNumber.class
└── src
│ └── exponential
│ └── ExponentialNumber.java
├── FibonacciSeries
├── .classpath
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
├── bin
│ └── fibonacci
│ │ └── Fibonacci.class
└── src
│ └── fibonacci
│ └── Fibonacci.java
├── MyFirstJavaProject
├── .classpath
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
├── bin
│ └── helloworld
│ │ └── HelloWorld.class
└── src
│ └── helloworld
│ └── HelloWorld.java
├── ObjectOrientedProgramming
├── .classpath
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
├── bin
│ ├── abstractclass
│ │ ├── AbstractTest.class
│ │ ├── Car.class
│ │ └── Vehicle.class
│ ├── encapsulation
│ │ ├── Car.class
│ │ ├── EncapsulationTest.class
│ │ └── Vehicle.class
│ ├── finalkeyword
│ │ ├── Car.class
│ │ ├── FinalTest.class
│ │ └── Vehicle.class
│ ├── inheritance
│ │ ├── Car.class
│ │ ├── InheritanceTest.class
│ │ ├── Motorcycle.class
│ │ └── Vehicle.class
│ ├── interfaceclasss
│ │ ├── Car.class
│ │ ├── Drivable.class
│ │ ├── InterfaceTest.class
│ │ └── Motorcycle.class
│ ├── methodoverride
│ │ ├── Car.class
│ │ ├── OverrideTest.class
│ │ └── Vehicle.class
│ ├── nestedclass
│ │ ├── InnerClassExample$InnerClass.class
│ │ ├── InnerClassExample.class
│ │ ├── InnerTest.class
│ │ ├── StaticNestedExample$StaticNestedClass.class
│ │ ├── StaticNestedExample.class
│ │ └── StaticNestedTest.class
│ ├── oopconcept
│ │ ├── Car.class
│ │ └── CarTest.class
│ ├── packageoperation
│ │ ├── Add.class
│ │ └── Multiply.class
│ ├── packagetest
│ │ └── Test.class
│ ├── polymorphism
│ │ ├── Car.class
│ │ ├── Motorcycle.class
│ │ ├── Test.class
│ │ └── Vehicle.class
│ ├── staticexample
│ │ ├── Car.class
│ │ └── Test.class
│ └── superthis
│ │ ├── Car.class
│ │ ├── SuperThisTest.class
│ │ └── Vehicle.class
└── src
│ ├── abstractclass
│ ├── AbstractTest.java
│ ├── Car.java
│ └── Vehicle.java
│ ├── encapsulation
│ ├── Car.java
│ ├── EncapsulationTest.java
│ └── Vehicle.java
│ ├── finalkeyword
│ ├── Car.java
│ ├── FinalTest.java
│ └── Vehicle.java
│ ├── inheritance
│ ├── Car.java
│ ├── InheritanceTest.java
│ ├── Motorcycle.java
│ └── Vehicle.java
│ ├── interfaceclasss
│ ├── Car.java
│ ├── Drivable.java
│ ├── InterfaceTest.java
│ └── Motorcycle.java
│ ├── methodoverride
│ ├── Car.java
│ ├── OverrideTest.java
│ └── Vehicle.java
│ ├── nestedclass
│ ├── InnerClassExample.java
│ ├── InnerTest.java
│ ├── StaticNestedExample.java
│ └── StaticNestedTest.java
│ ├── oopconcept
│ ├── Car.java
│ └── CarTest.java
│ ├── packageoperation
│ ├── Add.java
│ └── Multiply.java
│ ├── packagetest
│ └── Test.java
│ ├── polymorphism
│ ├── Car.java
│ ├── Motorcycle.java
│ ├── Test.java
│ └── Vehicle.java
│ ├── staticexample
│ ├── Car.java
│ └── Test.java
│ └── superthis
│ ├── Car.java
│ ├── SuperThisTest.java
│ └── Vehicle.java
└── String
├── .classpath
├── .project
├── .settings
└── org.eclipse.jdt.core.prefs
├── bin
├── string
│ ├── ReverseString.class
│ ├── StringExample.class
│ └── StringMethod.class
├── stringbuffer
│ └── StringBufferExample.class
└── stringbuilder
│ └── StringBuilderExample.class
└── src
├── string
├── ReverseString.java
├── StringExample.java
└── StringMethod.java
├── stringbuffer
└── StringBufferExample.java
└── stringbuilder
└── StringBuilderExample.java
/Core/BankAccountBalance/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Core/BankAccountBalance/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | BankAccountBalance
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Core/BankAccountBalance/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=10
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=10
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.release=enabled
12 | org.eclipse.jdt.core.compiler.source=10
13 |
--------------------------------------------------------------------------------
/Core/BankAccountBalance/bin/bankaccount/BankAccount.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/BankAccountBalance/bin/bankaccount/BankAccount.class
--------------------------------------------------------------------------------
/Core/BankAccountBalance/bin/bankaccount/InSufficientFundException.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/BankAccountBalance/bin/bankaccount/InSufficientFundException.class
--------------------------------------------------------------------------------
/Core/BankAccountBalance/bin/bankaccount/Test.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/BankAccountBalance/bin/bankaccount/Test.class
--------------------------------------------------------------------------------
/Core/BankAccountBalance/src/bankaccount/BankAccount.java:
--------------------------------------------------------------------------------
1 | package bankaccount;
2 |
3 | public class BankAccount {
4 |
5 | private double balance;
6 |
7 | // Constructor
8 | public BankAccount () {
9 | balance = 0.0;
10 | }
11 |
12 | // deposit method
13 | public void deposit (double amount) {
14 | balance = balance + amount;
15 | }
16 |
17 | // withdraw method
18 | public void withdraw (double amount) throws InSufficientFundException {
19 | if (amount > balance) {
20 | throw new InSufficientFundException("Insufficient Balance. "
21 | + "Withdraw process couldn't be completed.");
22 | }
23 | balance = balance - amount;
24 | }
25 |
26 | // getter method of balance
27 | public double getBalance() {
28 | return balance;
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/Core/BankAccountBalance/src/bankaccount/InSufficientFundException.java:
--------------------------------------------------------------------------------
1 | package bankaccount;
2 |
3 | public class InSufficientFundException extends Exception{
4 |
5 | private String message;
6 |
7 | // Constructor
8 | public InSufficientFundException (String message) {
9 | this.message = message;
10 | }
11 |
12 | // getter method of message
13 | public String getMessage() {
14 | return message;
15 | }
16 |
17 |
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/Core/BankAccountBalance/src/bankaccount/Test.java:
--------------------------------------------------------------------------------
1 | package bankaccount;
2 |
3 | import java.util.Scanner;
4 |
5 | public class Test {
6 |
7 | public static void main(String[] args) {
8 |
9 | BankAccount account = new BankAccount();
10 | Scanner input = new Scanner (System.in);
11 | int choice;
12 | do {
13 | System.out.println("-----BANK ACCOUNT MENU-----");
14 | System.out.println("1-Deposit");
15 | System.out.println("2-Withdraw");
16 | System.out.println("3-Show Current Balance");
17 | System.out.println("4-Quit");
18 | System.out.println("Select an option : ");
19 | choice = input.nextInt();
20 | switch (choice) {
21 | case 1 :
22 | System.out.println("Deposit Amount : ");
23 | account.deposit(input.nextInt());
24 | break;
25 | case 2 :
26 | System.out.println("Current Balance : " + account.getBalance());
27 | System.out.println("Withdraw Amount : ");
28 | try {
29 | account.withdraw(input.nextInt());
30 | } catch (InSufficientFundException e) {
31 | System.out.println(e.toString());
32 | }
33 | break;
34 | case 3 :
35 | System.out.println("Current Balance : " + account.getBalance());
36 | break;
37 | }
38 |
39 | } while (choice != 4);
40 | System.out.println("Bye..");
41 |
42 |
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/Core/Calculator/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Core/Calculator/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Calculator
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Core/Calculator/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=10
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=10
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.release=enabled
12 | org.eclipse.jdt.core.compiler.source=10
13 |
--------------------------------------------------------------------------------
/Core/Calculator/bin/calculator/Calculator.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Calculator/bin/calculator/Calculator.class
--------------------------------------------------------------------------------
/Core/Calculator/src/calculator/Calculator.java:
--------------------------------------------------------------------------------
1 | package calculator;
2 |
3 | import java.util.Scanner;
4 |
5 | public class Calculator {
6 |
7 | public static void main(String[] args) {
8 |
9 | Scanner input = new Scanner(System.in);
10 | System.out.println("-----CALCULATOR-----");
11 | System.out.println("Please enter 2 int numbers : ");
12 | int number1 = input.nextInt();
13 | int number2 = input.nextInt();
14 | System.out.println("Choose an operation (+,-,*,/,%) : ");
15 | char operator = input.next().charAt(0);
16 | double result = 0.0;
17 |
18 | switch (operator) {
19 | case '+' :
20 | result = number1+number2;
21 | break;
22 | case '-' :
23 | result = number1-number2;
24 | break;
25 | case '*' :
26 | result = number1*number2;
27 | break;
28 | case '/' :
29 | result = number1/number2;
30 | break;
31 | case '%' :
32 | result = number1%number2;
33 | break;
34 | default :
35 | System.out.println("Invalid operator choice!!!");
36 | return;
37 | }
38 | // display the result
39 | System.out.println(number1 + " " + operator + " " + number2 + " = "+ result);
40 | input.close();
41 |
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/Core/EnumTrafficLight/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Core/EnumTrafficLight/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | EnumTrafficLight
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Core/EnumTrafficLight/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=10
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=10
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.release=enabled
12 | org.eclipse.jdt.core.compiler.source=10
13 |
--------------------------------------------------------------------------------
/Core/EnumTrafficLight/bin/trafficlight/Baaaa.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/EnumTrafficLight/bin/trafficlight/Baaaa.class
--------------------------------------------------------------------------------
/Core/EnumTrafficLight/bin/trafficlight/TrafficLight.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/EnumTrafficLight/bin/trafficlight/TrafficLight.class
--------------------------------------------------------------------------------
/Core/EnumTrafficLight/bin/trafficlight/TrafficLightTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/EnumTrafficLight/bin/trafficlight/TrafficLightTest.class
--------------------------------------------------------------------------------
/Core/EnumTrafficLight/src/trafficlight/Baaaa.java:
--------------------------------------------------------------------------------
1 | package trafficlight;
2 |
3 | public class Baaaa {
4 |
5 | public static void main(String[] args) {
6 | // TODO Auto-generated method stub
7 |
8 | }
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/Core/EnumTrafficLight/src/trafficlight/TrafficLight.java:
--------------------------------------------------------------------------------
1 | package trafficlight;
2 |
3 | public enum TrafficLight {
4 |
5 | RED ("Stop"),
6 | YELLOW ("Wait"),
7 | GREEN ("Go") ;
8 |
9 | private String action;
10 |
11 | // constructor
12 | private TrafficLight (String action) {
13 | this.action = action;
14 | }
15 |
16 | // getter method of action
17 | public String getAction() {
18 | return action;
19 | }
20 |
21 |
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/Core/EnumTrafficLight/src/trafficlight/TrafficLightTest.java:
--------------------------------------------------------------------------------
1 | package trafficlight;
2 |
3 | public class TrafficLightTest {
4 |
5 | public static void main(String[] args) {
6 |
7 | TrafficLight [] lights = TrafficLight.values();
8 | // for-each loop starts to access Enum elements
9 | for (TrafficLight light : lights) {
10 | System.out.println("Light : " + light.toString()
11 | + " Action : " + light.getAction());
12 | }
13 |
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/Core/ExceptionHandling/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Core/ExceptionHandling/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | ExceptionHandling
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Core/ExceptionHandling/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=10
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=10
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.release=enabled
12 | org.eclipse.jdt.core.compiler.source=10
13 |
--------------------------------------------------------------------------------
/Core/ExceptionHandling/bin/exception/ExceptionHandling.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ExceptionHandling/bin/exception/ExceptionHandling.class
--------------------------------------------------------------------------------
/Core/ExceptionHandling/bin/exception/ThrowException.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ExceptionHandling/bin/exception/ThrowException.class
--------------------------------------------------------------------------------
/Core/ExceptionHandling/bin/exception/ThrowableMethod.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ExceptionHandling/bin/exception/ThrowableMethod.class
--------------------------------------------------------------------------------
/Core/ExceptionHandling/bin/exception/ThrowsException.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ExceptionHandling/bin/exception/ThrowsException.class
--------------------------------------------------------------------------------
/Core/ExceptionHandling/src/exception/ExceptionHandling.java:
--------------------------------------------------------------------------------
1 | package exception;
2 |
3 | import java.util.InputMismatchException;
4 | import java.util.Scanner;
5 |
6 | public class ExceptionHandling {
7 |
8 | public static void main(String[] args) {
9 |
10 | int number1 = 0, number2 = 0, result = 0;
11 | boolean isFlag = false;
12 | do {
13 | try {
14 | Scanner input = new Scanner (System.in);
15 | System.out.println("Enter first int number : ");
16 | number1 = input.nextInt();
17 | System.out.println("Enter second int number : ");
18 | number2 = input.nextInt();
19 | result = number1 / number2;
20 | System.out.println("Result : " + result);
21 | isFlag = true;
22 | input.close();
23 | }
24 | catch (InputMismatchException e) {
25 | System.out.println("Please enter valid number!");
26 | }
27 | catch (ArithmeticException e) {
28 | System.out.println("Second number can not be 0.");
29 | }
30 | catch (Exception e) {
31 | // any exception
32 | System.out.println("An exception occured.");
33 | }
34 | finally {
35 | System.out.println("This statement is always executed.");
36 | }
37 | } while (!isFlag);
38 |
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/Core/ExceptionHandling/src/exception/ThrowException.java:
--------------------------------------------------------------------------------
1 | package exception;
2 |
3 | public class ThrowException {
4 |
5 | public static double divide (double x, double y) {
6 |
7 | if (y == 0) {
8 | throw new ArithmeticException("Divider can not be equal to 0!");
9 | }
10 | return x / y;
11 | }
12 |
13 | public static void main(String[] args) {
14 |
15 | double d;
16 | try {
17 | d = divide (8.5,3.4);
18 | System.out.println("Result : " + d);
19 | }
20 | catch (ArithmeticException e) {
21 | System.out.println(e);
22 | }
23 |
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/Core/ExceptionHandling/src/exception/ThrowableMethod.java:
--------------------------------------------------------------------------------
1 | package exception;
2 |
3 | public class ThrowableMethod {
4 |
5 | public static double divide (double x, double y) {
6 |
7 | if (y == 0) {
8 | throw new ArithmeticException("ArithmeticException occured.");
9 | }
10 | return x / y;
11 | }
12 |
13 | public static void main(String[] args) {
14 |
15 | double d;
16 | try {
17 | d = divide (5.6,0);
18 | }
19 | catch (ArithmeticException e) {
20 | System.out.println("Divider can not be equal to zero.");
21 | // useful Throwable methods.
22 | //System.out.println(e.getMessage());
23 | //System.out.println(e.toString());
24 | e.printStackTrace();
25 | }
26 |
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/Core/ExceptionHandling/src/exception/ThrowsException.java:
--------------------------------------------------------------------------------
1 | package exception;
2 |
3 | public class ThrowsException {
4 |
5 | public static void divide ()
6 | throws ArithmeticException, NumberFormatException
7 | {
8 | int a = Integer.parseInt("8");
9 | int b = Integer.parseInt("0");
10 | int c = a / b;
11 | System.out.println("Result : " + c);
12 | }
13 |
14 | public static void main(String[] args) {
15 |
16 | try {
17 | divide ();
18 | }
19 | catch (NumberFormatException e) {
20 | System.out.println("Invalid number format!");
21 | }
22 | catch (ArithmeticException e) {
23 | System.out.println("You can not divide number by zero");
24 | }
25 |
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/Core/Exercise/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Core/Exercise/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Exercise
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Core/Exercise/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=10
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=10
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.release=enabled
12 | org.eclipse.jdt.core.compiler.source=10
13 |
--------------------------------------------------------------------------------
/Core/Exercise/bin/array/Array.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/array/Array.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/boxing/AutoBoxingUnBoxing.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/boxing/AutoBoxingUnBoxing.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/branching/BreakStatement.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/branching/BreakStatement.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/branching/ContinueStatement.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/branching/ContinueStatement.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/branching/ReturnStatement.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/branching/ReturnStatement.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/comment/Comment.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/comment/Comment.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/datatype/DataType.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/datatype/DataType.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/datatype/TypeCasting.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/datatype/TypeCasting.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/decisionmaking/IfElseStatement.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/decisionmaking/IfElseStatement.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/decisionmaking/IfLadderNestedIfStatement.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/decisionmaking/IfLadderNestedIfStatement.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/decisionmaking/SwitchCaseStatement.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/decisionmaking/SwitchCaseStatement.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/enumtype/Color.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/enumtype/Color.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/enumtype/ColorTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/enumtype/ColorTest.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/inputoutput/BasicInput.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/inputoutput/BasicInput.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/inputoutput/BasicOutput.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/inputoutput/BasicOutput.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/loop/DoWhileLoop.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/loop/DoWhileLoop.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/loop/ForEachLoop.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/loop/ForEachLoop.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/loop/ForLoop.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/loop/ForLoop.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/loop/WhileLoop.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/loop/WhileLoop.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/method/MethodExample.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/method/MethodExample.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/method/MethodOverloading.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/method/MethodOverloading.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/operator/ArithmeticOperator.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/operator/ArithmeticOperator.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/operator/AssignmentOperator.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/operator/AssignmentOperator.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/operator/ConditionalOperator.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/operator/ConditionalOperator.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/operator/EqualityRelationalOperator.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/operator/EqualityRelationalOperator.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/operator/OperatorPresedence.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/operator/OperatorPresedence.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/operator/UnaryOperator.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/operator/UnaryOperator.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/swing/SwingExample.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/swing/SwingExample.class
--------------------------------------------------------------------------------
/Core/Exercise/bin/variable/Variable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/Exercise/bin/variable/Variable.class
--------------------------------------------------------------------------------
/Core/Exercise/src/array/Array.java:
--------------------------------------------------------------------------------
1 | package array;
2 |
3 | public class Array {
4 |
5 | public static void main(String[] args) {
6 |
7 | int[] numbers;
8 | numbers = new int[4];
9 |
10 | numbers[0]=4;
11 | numbers[1]=6;
12 | numbers[2]=-3;
13 | numbers[3]=-2;
14 |
15 | System.out.println("Sum : " + (numbers[0]+numbers[1]+numbers[2]+numbers[3]));
16 |
17 | int[] number = {4,6,-3,-2};
18 | number[1] = 12;
19 | System.out.println("------------");
20 | System.out.println("New Sum : " + (number[0]+number[1]+number[2]+number[3]));
21 |
22 |
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/Core/Exercise/src/boxing/AutoBoxingUnBoxing.java:
--------------------------------------------------------------------------------
1 | package boxing;
2 |
3 | public class AutoBoxingUnBoxing {
4 |
5 | public static void main(String[] args) {
6 |
7 | Double db = 12.8; // Auto-boxing of double
8 | double d = db; // Auto-unboxing of Double
9 | System.out.println(db + " " + d);
10 |
11 | Integer in = 5; // Auto-boxing of int
12 | int i = in; // Auto-unboxing of Integer
13 | System.out.println(in + " " + i);
14 |
15 | Character ch = 'b'; // Auto-boxing of char
16 | char c = ch; // Auto-unboxing of Character
17 | System.out.println(ch + " " + c);
18 |
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/Core/Exercise/src/branching/BreakStatement.java:
--------------------------------------------------------------------------------
1 | package branching;
2 |
3 | public class BreakStatement {
4 |
5 | public static void main(String[] args) {
6 |
7 | /*int number = 100;
8 | if (number == 100)
9 | break;
10 | System.out.println("Hi!");*/
11 |
12 |
13 | for (int i = 0; i<10; i++) {
14 | if (i == 7)
15 | break;
16 | System.out.println(i);
17 | }
18 |
19 |
20 |
21 | /*int a = 0;
22 | switch (a) {
23 | case 0:
24 | System.out.println("Hi!");
25 | case 1:
26 | System.out.println("Hello!");
27 | break;
28 | }*/
29 |
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/Core/Exercise/src/branching/ContinueStatement.java:
--------------------------------------------------------------------------------
1 | package branching;
2 |
3 | public class ContinueStatement {
4 |
5 | public static void main(String[] args) {
6 |
7 | /*int k = 50;
8 | if (k == 50)
9 | continue;
10 | System.out.println("Hello!");*/
11 |
12 |
13 | for (int i = 0; i < 10 ; i++) {
14 | if (i % 2 == 0)
15 | continue;
16 | System.out.println(i);
17 | }
18 |
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/Core/Exercise/src/branching/ReturnStatement.java:
--------------------------------------------------------------------------------
1 | package branching;
2 |
3 | public class ReturnStatement {
4 |
5 | public static void main(String[] args) {
6 |
7 | boolean bool = true;
8 | System.out.println("Before the return");
9 | if (bool)
10 | return;
11 | System.out.println("This statement will not be executed.");
12 |
13 | /*int k = 2;
14 | switch (k) {
15 | case 1 :
16 | System.out.println("1");
17 | break;
18 | case 2 :
19 | System.out.println("2");
20 | return;
21 | }
22 | System.out.println("Welcome!");*/
23 |
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/Core/Exercise/src/comment/Comment.java:
--------------------------------------------------------------------------------
1 | package comment;
2 |
3 | public class Comment {
4 |
5 | /*
6 | * This is a multi line comment.
7 | * This method displays Welcome to Java text on the screen
8 | */
9 |
10 | public static void main(String[] args) {
11 |
12 |
13 | // This is a single line comment.
14 | // prints Welcome to Java text
15 | System.out.println("Welcome to Java");
16 | int a=5,b=2,sum=0;
17 | sum = a+b;
18 | System.out.println("Sum : "+sum);
19 |
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/Core/Exercise/src/datatype/DataType.java:
--------------------------------------------------------------------------------
1 | package datatype;
2 |
3 | public class DataType {
4 |
5 | public static void main(String[] args) {
6 |
7 | boolean a = true;
8 | char b = 'R';
9 | byte c = 12;
10 | short d = -356;
11 | int e = 43543;
12 | long f = -432543234L;
13 | float g = 5.68764324F;
14 | double h = 7.34534276464;
15 |
16 | System.out.println(a);
17 | System.out.println(b);
18 | System.out.println(c);
19 | System.out.println(d);
20 | System.out.println(e);
21 | System.out.println(f);
22 | System.out.println(g);
23 | System.out.println(h);
24 |
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/Core/Exercise/src/datatype/TypeCasting.java:
--------------------------------------------------------------------------------
1 | package datatype;
2 |
3 | public class TypeCasting {
4 |
5 | public static void main(String[] args) {
6 |
7 | int a = 124;
8 | long b = a;
9 | double d = b;
10 |
11 | System.out.println("int value : " + a);
12 | System.out.println("long value : " + b);
13 | System.out.println("double value : " + d);
14 |
15 | double s = 86.02;
16 | long m = (long) s;
17 | byte c = (byte) m;
18 |
19 | System.out.println("---------------------");
20 | System.out.println("double value : " + s);
21 | System.out.println("long value : " + m);
22 | System.out.println("byte value : " + c);
23 |
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/Core/Exercise/src/decisionmaking/IfElseStatement.java:
--------------------------------------------------------------------------------
1 | package decisionmaking;
2 |
3 | import java.util.Scanner;
4 |
5 | public class IfElseStatement {
6 |
7 | public static void main(String[] args) {
8 |
9 | Scanner inputNumber = new Scanner(System.in);
10 | System.out.println("Please enter a number : ");
11 | int number = inputNumber.nextInt();
12 | if (number %2==0) {
13 | System.out.println("Number is even");
14 | }
15 | else {
16 | System.out.println("Number is odd");
17 | }
18 | inputNumber.close();
19 |
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/Core/Exercise/src/decisionmaking/IfLadderNestedIfStatement.java:
--------------------------------------------------------------------------------
1 | package decisionmaking;
2 |
3 | import java.util.Scanner;
4 |
5 | public class IfLadderNestedIfStatement {
6 |
7 | public static void main(String[] args) {
8 |
9 | Scanner number = new Scanner(System.in);
10 | System.out.print("Please enter 3 numbers : ");
11 | int number1, number2, number3, largestNumber;
12 | number1 = number.nextInt();
13 | number2 = number.nextInt();
14 | number3 = number.nextInt();
15 |
16 | if (number1 >= number2) {
17 | if (number1 >= number3) {
18 | largestNumber = number1;
19 | }
20 | else {
21 | largestNumber = number3;
22 | }
23 | }
24 | else {
25 | if (number2 >= number3) {
26 | largestNumber = number2;
27 | }
28 | else {
29 | largestNumber = number3;
30 | }
31 | }
32 | System.out.println("Largest Number : " + largestNumber);
33 | number.close();
34 |
35 |
36 | /*Scanner age = new Scanner(System.in);
37 | System.out.print("Please enter your age : ");
38 | int yourAge = age.nextInt();
39 |
40 | if(yourAge < 13) {
41 | System.out.println("You are a child");
42 | }
43 | else if (yourAge < 19) {
44 | System.out.println("You are a teenager");
45 | }
46 | else {
47 | if (yourAge < 65) {
48 | System.out.println("You are an adult");
49 | }
50 | else {
51 | System.out.println("You are a senior");
52 | }
53 | }*/
54 |
55 |
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/Core/Exercise/src/decisionmaking/SwitchCaseStatement.java:
--------------------------------------------------------------------------------
1 | package decisionmaking;
2 |
3 | import java.util.Scanner;
4 |
5 | public class SwitchCaseStatement {
6 |
7 | public static void main(String[] args) {
8 |
9 | Scanner number = new Scanner(System.in);
10 | System.out.println("Please enter a day number of week : ");
11 | int dayNumber = number.nextInt();
12 | String day;
13 | switch (dayNumber) {
14 | case 1:
15 | day = "Monday";
16 | break;
17 | case 2:
18 | day = "Tuesday";
19 | break;
20 | case 3:
21 | day = "Wednesday";
22 | break;
23 | case 4:
24 | day = "Thursday";
25 | break;
26 | case 5:
27 | day = "Friday";
28 | break;
29 | case 6:
30 | day = "Saturday";
31 | break;
32 | case 7:
33 | day = "Sunday";
34 | break;
35 | default:
36 | day = "Invalid day choice";
37 | break;
38 | }
39 | System.out.println("Day : " + day);
40 | number.close();
41 |
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/Core/Exercise/src/enumtype/Color.java:
--------------------------------------------------------------------------------
1 | package enumtype;
2 |
3 | public enum Color {
4 |
5 | RED,
6 | YELLOW,
7 | GREEN ;
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/Core/Exercise/src/enumtype/ColorTest.java:
--------------------------------------------------------------------------------
1 | package enumtype;
2 |
3 | import java.util.Scanner;
4 |
5 | public class ColorTest {
6 |
7 | public static void main(String[] args) {
8 |
9 | Scanner input = new Scanner (System.in);
10 | System.out.println("Enter a color : ");
11 | String inputColor = input.next();
12 | try {
13 | Color color = Color.valueOf(inputColor.toUpperCase());
14 | switch (color) {
15 | case RED :
16 | System.out.println("You entered RED.");
17 | break;
18 | case YELLOW :
19 | System.out.println("You entered YELLOW.");
20 | break;
21 | case GREEN :
22 | System.out.println("You entered GREEN.");
23 | }
24 | }
25 | catch (IllegalArgumentException e) {
26 | System.out.println("Please enter enum constant type "
27 | + "[RED, YELLOW, GREEN]");
28 | }
29 |
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/Core/Exercise/src/inputoutput/BasicInput.java:
--------------------------------------------------------------------------------
1 | package inputoutput;
2 |
3 | import java.util.Scanner;
4 |
5 | public class BasicInput {
6 |
7 | public static void main(String[] args) {
8 |
9 | Scanner inputText = new Scanner(System.in);
10 | System.out.println("Please enter a text : ");
11 |
12 | System.out.println("You entered : "+inputText.next());
13 | inputText.close();
14 |
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/Core/Exercise/src/inputoutput/BasicOutput.java:
--------------------------------------------------------------------------------
1 | package inputoutput;
2 |
3 | public class BasicOutput {
4 |
5 | public static void main(String[] args) {
6 |
7 | System.out.println("Welcome to Java Programming");
8 | System.out.println("Welcome to " + "Java Programming");
9 |
10 | System.out.println("Welcome ");
11 | System.out.println("to ");
12 | System.out.print("Java ");
13 | System.out.print("Programming");
14 |
15 | int x = 5;
16 | int y = 3;
17 | int z = x+y;
18 | System.out.printf("Result : %d + %d = %d",x,y,z);
19 |
20 |
21 |
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/Core/Exercise/src/loop/DoWhileLoop.java:
--------------------------------------------------------------------------------
1 | package loop;
2 |
3 | import java.util.Scanner;
4 |
5 | public class DoWhileLoop {
6 |
7 | public static void main(String[] args) {
8 |
9 | Scanner input = new Scanner(System.in);
10 | int choice;
11 |
12 | do {
13 | System.out.println("-----MENU-----");
14 | System.out.println("1. Apple");
15 | System.out.println("2. Banana");
16 | System.out.println("3. Orange");
17 | System.out.println("4. Exit");
18 | System.out.print("Select an option : ");
19 | choice = input.nextInt();
20 | switch (choice) {
21 | case 1 :
22 | System.out.println("Apple");
23 | break;
24 | case 2 :
25 | System.out.println("Banana");
26 | break;
27 | case 3 :
28 | System.out.println("Orange");
29 | break;
30 | }
31 |
32 | } while (choice != 4);
33 |
34 |
35 | /*int number = 1;
36 | do {
37 | System.out.print(number + " ");
38 | number++;
39 | } while (number <= 15);*/
40 |
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/Core/Exercise/src/loop/ForEachLoop.java:
--------------------------------------------------------------------------------
1 | package loop;
2 |
3 | public class ForEachLoop {
4 |
5 | public static void main(String[] args) {
6 |
7 | /*char[] letters = {'h','e','l','l','o'};
8 | for (int i = 0; i1) {
9 | System.out.println(i);
10 | i--;
11 |
12 | }*/
13 |
14 | int k = 1, fact = 1;
15 | while (k <= 5) {
16 | fact *=k; // fact = fact * k;
17 | System.out.println(k + "!" + " = "+fact);
18 | k++;
19 | }
20 |
21 | // infinite while loop
22 | /*while (true) {
23 |
24 | }*/
25 |
26 | /*int d = 100;
27 | while (d == 100) { // infinite while loop
28 |
29 | }*/
30 |
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/Core/Exercise/src/method/MethodExample.java:
--------------------------------------------------------------------------------
1 | package method;
2 |
3 | import java.util.Scanner;
4 |
5 | public class MethodExample {
6 |
7 | public static void main(String[] args) {
8 |
9 | Scanner input = new Scanner (System.in);
10 | System.out.print("Please enter 2 numbers : ");
11 | int number1 = input.nextInt();
12 | int number2 = input.nextInt();
13 | show(number1,number2); // void method calling
14 | int a = add (number1,number2); // int method calling
15 | int b = min (number1,number2); // int method calling
16 | System.out.println("Sum of numbers : " + a);
17 | System.out.println("Minimum number : "+ b);
18 |
19 |
20 | }
21 |
22 | // displays numbers.
23 | public static void show (int num1, int num2) {
24 | System.out.println("You entered : " + num1 + " and "+num2);
25 | }
26 |
27 | // returns the sum of two numbers.
28 | public static int add (int num1, int num2) {
29 | int sum = 0;
30 | sum = num1 + num2;
31 | return sum;
32 | }
33 |
34 | // returns the minimum of two numbers.
35 | public static int min (int num1, int num2) {
36 | int min;
37 | if (num1 > num2)
38 | min = num2;
39 | else
40 | min = num1;
41 | return min;
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/Core/Exercise/src/method/MethodOverloading.java:
--------------------------------------------------------------------------------
1 | package method;
2 |
3 | public class MethodOverloading {
4 |
5 | public static void main(String[] args) {
6 |
7 | System.out.println("Sum of two numbers : " + add(10,20));
8 | System.out.println("Sum of three numbers : " + add (10,20,30));
9 | System.out.println("Sum of two double numbers : " + add(4.6,8.4));
10 |
11 | }
12 |
13 | public static int add (int x, int y) {
14 | return x + y;
15 | }
16 |
17 | public static int add (int x, int y, int z) {
18 | return x + y + z;
19 | }
20 |
21 | public static double add (double x, double y) {
22 | return x + y;
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/Core/Exercise/src/operator/ArithmeticOperator.java:
--------------------------------------------------------------------------------
1 | package operator;
2 |
3 | public class ArithmeticOperator {
4 |
5 | public static void main(String[] args) {
6 |
7 | double number1 = 8.4, number2 = 4.2, result = 0.0;
8 | result = number1 + number2;
9 | System.out.println("Number1 + Number2 : "+result);
10 |
11 | result = number1 - number2;
12 | System.out.println("Number1 - Number2 : "+result);
13 |
14 | result = number1 * number2;
15 | System.out.println("Number1 * Number2 : "+result);
16 |
17 | result = number1 / number2;
18 | System.out.println("Number1 / Number2 : "+result);
19 |
20 | result = number1 % number2;
21 | System.out.println("Number1 % Number2 : "+result);
22 |
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/Core/Exercise/src/operator/AssignmentOperator.java:
--------------------------------------------------------------------------------
1 | package operator;
2 |
3 | public class AssignmentOperator {
4 |
5 | public static void main(String[] args) {
6 |
7 | int x = 20, y = 15, z = 0;
8 |
9 | z = x + y;
10 | System.out.println("z = x + y = "+z);
11 |
12 | z +=x; // z = z + x
13 | System.out.println("z +=x = "+z);
14 |
15 | z -=x; // z = z - x
16 | System.out.println("z -=x = "+z);
17 |
18 | z *=x; // z = z * x
19 | System.out.println("z *=x = "+z);
20 |
21 | z /=x; // z = z / x
22 | System.out.println("z /=x = "+z);
23 |
24 | z %=x; // z = z % x
25 | System.out.println("z %=x = "+z);
26 |
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/Core/Exercise/src/operator/ConditionalOperator.java:
--------------------------------------------------------------------------------
1 | package operator;
2 |
3 | public class ConditionalOperator {
4 |
5 | public static void main(String[] args) {
6 |
7 | int number1 = 5, number2 = 8, number3 = 12;
8 | boolean result;
9 |
10 | // Conditional AND Operator (&&)
11 | result = (number1>number2) && (number3>number1);
12 | System.out.println("Result = " + result);
13 |
14 | // Conditional OR Operator (||)
15 | result = (number1>number2) || (number3>number2);
16 | System.out.println("Result = " + result);
17 |
18 | // Ternary Operator (?)
19 | result = number1 b : " + (a>b));
12 | System.out.println("a >= b : " + (a>=b));
13 | System.out.println("a < b : " + (a
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Core/ExponentialNumber/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | ExponentialNumber
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Core/ExponentialNumber/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=10
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=10
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.release=enabled
12 | org.eclipse.jdt.core.compiler.source=10
13 |
--------------------------------------------------------------------------------
/Core/ExponentialNumber/bin/exponential/ExponentialNumber.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ExponentialNumber/bin/exponential/ExponentialNumber.class
--------------------------------------------------------------------------------
/Core/ExponentialNumber/src/exponential/ExponentialNumber.java:
--------------------------------------------------------------------------------
1 | package exponential;
2 |
3 | import java.util.Scanner;
4 |
5 | public class ExponentialNumber {
6 |
7 | public static void main(String[] args) {
8 |
9 | Scanner input = new Scanner(System.in);
10 | System.out.println("Enter an integer base number : ");
11 | int base = input.nextInt();
12 | System.out.println("Enter exponent : ");
13 | int exponent = input.nextInt();
14 | for (int i = 0; i<=exponent; i++) {
15 | System.out.println(base + " to the power " + i + " is : " + pow(base,i));
16 | }
17 | input.close();
18 |
19 | }
20 |
21 | public static int pow (int num, int power) {
22 | return (int) Math.pow(num, power);
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/Core/FibonacciSeries/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Core/FibonacciSeries/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | FibonacciSeries
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Core/FibonacciSeries/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=10
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=10
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.release=enabled
12 | org.eclipse.jdt.core.compiler.source=10
13 |
--------------------------------------------------------------------------------
/Core/FibonacciSeries/bin/fibonacci/Fibonacci.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/FibonacciSeries/bin/fibonacci/Fibonacci.class
--------------------------------------------------------------------------------
/Core/FibonacciSeries/src/fibonacci/Fibonacci.java:
--------------------------------------------------------------------------------
1 | package fibonacci;
2 |
3 | import java.util.Scanner;
4 |
5 | public class Fibonacci {
6 |
7 | public static void main(String[] args) {
8 |
9 | // Fibonacci Sequence : 0,1,1,2,3,5,8,13,21,34,55.....
10 |
11 | Scanner input = new Scanner(System.in);
12 | System.out.print("Input Max Sequence Number : ");
13 | int number = input.nextInt();
14 | int fibPrevious = 0, fibonacci = 1, sum = 0;
15 | for (int i=1; i<=number; i++) {
16 | System.out.print(fibPrevious + " ");
17 | sum = fibPrevious + fibonacci;
18 | fibPrevious = fibonacci;
19 | fibonacci = sum;
20 | }
21 |
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/Core/MyFirstJavaProject/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Core/MyFirstJavaProject/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | MyFirstJavaProject
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Core/MyFirstJavaProject/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=11
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.release=enabled
12 | org.eclipse.jdt.core.compiler.source=11
13 |
--------------------------------------------------------------------------------
/Core/MyFirstJavaProject/bin/helloworld/HelloWorld.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/MyFirstJavaProject/bin/helloworld/HelloWorld.class
--------------------------------------------------------------------------------
/Core/MyFirstJavaProject/src/helloworld/HelloWorld.java:
--------------------------------------------------------------------------------
1 | package helloworld;
2 |
3 | public class HelloWorld {
4 |
5 | public static void main(String[] args) {
6 |
7 | System.out.println("Hello World!");
8 |
9 | }
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | ObjectOrientedProgramming
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=10
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=10
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.release=enabled
12 | org.eclipse.jdt.core.compiler.source=10
13 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/abstractclass/AbstractTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/abstractclass/AbstractTest.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/abstractclass/Car.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/abstractclass/Car.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/abstractclass/Vehicle.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/abstractclass/Vehicle.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/encapsulation/Car.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/encapsulation/Car.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/encapsulation/EncapsulationTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/encapsulation/EncapsulationTest.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/encapsulation/Vehicle.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/encapsulation/Vehicle.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/finalkeyword/Car.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/finalkeyword/Car.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/finalkeyword/FinalTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/finalkeyword/FinalTest.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/finalkeyword/Vehicle.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/finalkeyword/Vehicle.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/inheritance/Car.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/inheritance/Car.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/inheritance/InheritanceTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/inheritance/InheritanceTest.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/inheritance/Motorcycle.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/inheritance/Motorcycle.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/inheritance/Vehicle.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/inheritance/Vehicle.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/interfaceclasss/Car.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/interfaceclasss/Car.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/interfaceclasss/Drivable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/interfaceclasss/Drivable.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/interfaceclasss/InterfaceTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/interfaceclasss/InterfaceTest.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/interfaceclasss/Motorcycle.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/interfaceclasss/Motorcycle.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/methodoverride/Car.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/methodoverride/Car.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/methodoverride/OverrideTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/methodoverride/OverrideTest.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/methodoverride/Vehicle.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/methodoverride/Vehicle.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/nestedclass/InnerClassExample$InnerClass.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/nestedclass/InnerClassExample$InnerClass.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/nestedclass/InnerClassExample.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/nestedclass/InnerClassExample.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/nestedclass/InnerTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/nestedclass/InnerTest.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/nestedclass/StaticNestedExample$StaticNestedClass.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/nestedclass/StaticNestedExample$StaticNestedClass.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/nestedclass/StaticNestedExample.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/nestedclass/StaticNestedExample.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/nestedclass/StaticNestedTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/nestedclass/StaticNestedTest.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/oopconcept/Car.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/oopconcept/Car.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/oopconcept/CarTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/oopconcept/CarTest.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/packageoperation/Add.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/packageoperation/Add.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/packageoperation/Multiply.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/packageoperation/Multiply.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/packagetest/Test.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/packagetest/Test.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/polymorphism/Car.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/polymorphism/Car.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/polymorphism/Motorcycle.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/polymorphism/Motorcycle.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/polymorphism/Test.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/polymorphism/Test.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/polymorphism/Vehicle.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/polymorphism/Vehicle.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/staticexample/Car.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/staticexample/Car.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/staticexample/Test.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/staticexample/Test.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/superthis/Car.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/superthis/Car.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/superthis/SuperThisTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/superthis/SuperThisTest.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/bin/superthis/Vehicle.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/ObjectOrientedProgramming/bin/superthis/Vehicle.class
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/abstractclass/AbstractTest.java:
--------------------------------------------------------------------------------
1 | package abstractclass;
2 |
3 | public class AbstractTest {
4 |
5 | public static void main(String[] args) {
6 |
7 | // Creating Car object.
8 | Car car = new Car("Car", "Ferrari");
9 | car.start();
10 | car.stop();
11 | car.getMaxSpeed();
12 |
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/abstractclass/Car.java:
--------------------------------------------------------------------------------
1 | package abstractclass;
2 |
3 | public class Car extends Vehicle {
4 |
5 | public Car(String type, String model) {
6 | super(type, model);
7 |
8 | }
9 |
10 | @Override
11 | public int getMaxSpeed() {
12 | final int MAX_CAR_SPEED = 320;
13 | System.out.println("Max speed of Car is : " + MAX_CAR_SPEED);
14 | return MAX_CAR_SPEED;
15 | }
16 |
17 | @Override
18 | public void start () {
19 | System.out.println("Car has started.");
20 | }
21 |
22 | @Override
23 | public void stop () {
24 | System.out.println("Car has stopped.");
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/abstractclass/Vehicle.java:
--------------------------------------------------------------------------------
1 | package abstractclass;
2 |
3 | public abstract class Vehicle {
4 |
5 | String type, model;
6 |
7 | // constructor
8 | public Vehicle (String type, String model) {
9 | this.type = type;
10 | this.model = model;
11 | }
12 |
13 | // non-abstract method
14 | public void start () {
15 | System.out.println("Vehicle has started.");
16 | }
17 |
18 | // non-abstract method
19 | public void stop () {
20 | System.out.println("Vehicle has stopped.");
21 | }
22 |
23 | // abstract method
24 | public abstract int getMaxSpeed();
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/encapsulation/Car.java:
--------------------------------------------------------------------------------
1 | package encapsulation;
2 |
3 | public class Car extends Vehicle {
4 |
5 | private boolean isAutomatic = false;
6 |
7 | public Car(String model, int maxSpeed, boolean isAutomatic) {
8 | super(model, maxSpeed);
9 | this.isAutomatic = isAutomatic;
10 | }
11 |
12 | public boolean isAutomatic() {
13 | return isAutomatic;
14 | }
15 |
16 | public void setAutomatic(boolean isAutomatic) {
17 | this.isAutomatic = isAutomatic;
18 | }
19 |
20 |
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/encapsulation/EncapsulationTest.java:
--------------------------------------------------------------------------------
1 | package encapsulation;
2 |
3 | public class EncapsulationTest {
4 |
5 | public static void main(String[] args) {
6 |
7 | // Creating Car object.
8 | Car car = new Car("Ferrari", 320, true);
9 | System.out.println("Model : " + car.getModel());
10 | System.out.println("Max Speed : " + car.getMaxSpeed());
11 | System.out.println("Is automatic ? : " + car.isAutomatic());
12 |
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/encapsulation/Vehicle.java:
--------------------------------------------------------------------------------
1 | package encapsulation;
2 |
3 | public class Vehicle {
4 |
5 | private String model;
6 | private int maxSpeed;
7 |
8 | public Vehicle (String model, int maxSpeed) {
9 | this.model = model;
10 | this.maxSpeed = maxSpeed;
11 | }
12 |
13 | public int getMaxSpeed() {
14 | return maxSpeed;
15 | }
16 |
17 | public void setMaxSpeed(int maxSpeed) {
18 | this.maxSpeed = maxSpeed;
19 | }
20 |
21 | public String getModel() {
22 | return model;
23 | }
24 |
25 | public void setModel(String model) {
26 | this.model = model;
27 | }
28 |
29 |
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/finalkeyword/Car.java:
--------------------------------------------------------------------------------
1 | package finalkeyword;
2 |
3 | public class Car extends Vehicle {
4 |
5 | // override method
6 | public void showMaxSpeed () {
7 | System.out.println("Max speed of Car is 320");
8 | }
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/finalkeyword/FinalTest.java:
--------------------------------------------------------------------------------
1 | package finalkeyword;
2 |
3 | public class FinalTest {
4 |
5 | public static void main(String[] args) {
6 |
7 | // Creating Car object.
8 | Car car = new Car ();
9 | car.model = "Ferrari";
10 | car.showMaxSpeed();
11 |
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/finalkeyword/Vehicle.java:
--------------------------------------------------------------------------------
1 | package finalkeyword;
2 |
3 | public class Vehicle {
4 |
5 | String model = "";
6 |
7 | public void showMaxSpeed () {
8 | System.out.println("Max speed of Vehicle is 180");
9 | }
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/inheritance/Car.java:
--------------------------------------------------------------------------------
1 | package inheritance;
2 |
3 | public class Car extends Vehicle {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/inheritance/InheritanceTest.java:
--------------------------------------------------------------------------------
1 | package inheritance;
2 |
3 | public class InheritanceTest {
4 |
5 | public static void main(String[] args) {
6 |
7 | // Creating Car object.
8 | Car car = new Car ();
9 | car.type = "Car";
10 | car.model = "Ferrari";
11 | car.maxSpeed = 320;
12 | car.print();
13 |
14 | // Creating Motorcycle object.
15 | Motorcycle motor = new Motorcycle();
16 | motor.type = "Motorcycle";
17 | motor.model = "Kawasaki";
18 | motor.maxSpeed = 180;
19 | motor.print();
20 |
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/inheritance/Motorcycle.java:
--------------------------------------------------------------------------------
1 | package inheritance;
2 |
3 | public class Motorcycle extends Vehicle{
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/inheritance/Vehicle.java:
--------------------------------------------------------------------------------
1 | package inheritance;
2 |
3 | public class Vehicle {
4 |
5 | String type, model;
6 | int maxSpeed;
7 |
8 | public void print () {
9 | System.out.println("Type : " + type);
10 | System.out.println("Model : " + model);
11 | System.out.println("Max Speed : " + maxSpeed);
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/interfaceclasss/Car.java:
--------------------------------------------------------------------------------
1 | package interfaceclasss;
2 |
3 | public class Car implements Drivable {
4 |
5 | @Override
6 | public void turnLeft() {
7 | System.out.println("Car can turn left");
8 | }
9 |
10 | @Override
11 | public void turnRight() {
12 | System.out.println("Car can turn right");
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/interfaceclasss/Drivable.java:
--------------------------------------------------------------------------------
1 | package interfaceclasss;
2 |
3 | public interface Drivable {
4 |
5 | void turnLeft();
6 | void turnRight();
7 |
8 | }
9 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/interfaceclasss/InterfaceTest.java:
--------------------------------------------------------------------------------
1 | package interfaceclasss;
2 |
3 | public class InterfaceTest {
4 |
5 | public static void main(String[] args) {
6 |
7 | // Creating Car object
8 | Car car = new Car ();
9 | car.turnLeft();
10 | car.turnRight();
11 |
12 | // Creating Motorcycle object
13 | Motorcycle motor = new Motorcycle();
14 | motor.turnLeft();
15 | motor.turnRight();
16 |
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/interfaceclasss/Motorcycle.java:
--------------------------------------------------------------------------------
1 | package interfaceclasss;
2 |
3 | public class Motorcycle implements Drivable {
4 |
5 | @Override
6 | public void turnLeft() {
7 | System.out.println("Motorcycle can turn left");
8 | }
9 |
10 | @Override
11 | public void turnRight() {
12 | System.out.println("Motorcycle can turn right");
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/methodoverride/Car.java:
--------------------------------------------------------------------------------
1 | package methodoverride;
2 |
3 | public class Car extends Vehicle {
4 |
5 | public void start () {
6 | System.out.println("Car has started.");
7 | }
8 |
9 | public void accelerate (int speed) {
10 | System.out.println("Car accelerates at " + speed);
11 | }
12 |
13 | public void stop () {
14 | System.out.println("Car has stopped.");
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/methodoverride/OverrideTest.java:
--------------------------------------------------------------------------------
1 | package methodoverride;
2 |
3 | public class OverrideTest {
4 |
5 | public static void main(String[] args) {
6 |
7 | // Creating Vehicle object.
8 | Vehicle vehicle = new Vehicle();
9 | vehicle.start();
10 | vehicle.accelerate(80);
11 | vehicle.stop();
12 |
13 | // Creating Car object.
14 | Car car = new Car();
15 | car.start();
16 | car.accelerate(100);
17 | car.stop();
18 |
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/methodoverride/Vehicle.java:
--------------------------------------------------------------------------------
1 | package methodoverride;
2 |
3 | public class Vehicle {
4 |
5 | public void start () {
6 | System.out.println("Vehicle has started.");
7 | }
8 |
9 | public void accelerate (int speed) {
10 | System.out.println("Vehicle accelerates at " + speed);
11 | }
12 |
13 | public void stop () {
14 | System.out.println("Vehicle has stopped.");
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/nestedclass/InnerClassExample.java:
--------------------------------------------------------------------------------
1 | package nestedclass;
2 |
3 | public class InnerClassExample {
4 |
5 | static int a = 5;
6 | private static int b = 10;
7 | int c = 15;
8 |
9 | class InnerClass {
10 | void show () {
11 | System.out.println("a = " + a);
12 | System.out.println("b = " + b);
13 | System.out.println("c = " + c); // we can access to non-static variable
14 | }
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/nestedclass/InnerTest.java:
--------------------------------------------------------------------------------
1 | package nestedclass;
2 |
3 | public class InnerTest {
4 |
5 | public static void main(String[] args) {
6 |
7 | InnerClassExample outer = new InnerClassExample();
8 | InnerClassExample.InnerClass inner = outer.new InnerClass();
9 | inner.show();
10 |
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/nestedclass/StaticNestedExample.java:
--------------------------------------------------------------------------------
1 | package nestedclass;
2 |
3 | public class StaticNestedExample {
4 |
5 | static int a = 5;
6 | private static int b = 10;
7 | int c = 15;
8 |
9 | static class StaticNestedClass {
10 | void show () {
11 | System.out.println("a = " + a);
12 | System.out.println("b = " + b);
13 | //System.out.println("c = " + c);
14 | }
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/nestedclass/StaticNestedTest.java:
--------------------------------------------------------------------------------
1 | package nestedclass;
2 |
3 | public class StaticNestedTest {
4 |
5 | public static void main(String[] args) {
6 |
7 | StaticNestedExample.StaticNestedClass nested =
8 | new StaticNestedExample.StaticNestedClass();
9 | nested.show();
10 |
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/oopconcept/Car.java:
--------------------------------------------------------------------------------
1 | package oopconcept;
2 |
3 | public class Car {
4 |
5 | private String model;
6 | private int currentSpeed;
7 | private String color;
8 | private int year;
9 |
10 | // constructors
11 | public Car (String model) {
12 | this.model = model;
13 | }
14 |
15 | public Car (String model, String color, int year) {
16 | this.model = model;
17 | this.color = color;
18 | this.year = year;
19 | }
20 |
21 | // methods
22 | public void start () {
23 | System.out.println(this.model + " has started.");
24 | }
25 |
26 | public void accelerate () {
27 | this.currentSpeed +=20;
28 | }
29 |
30 | public void stop () {
31 | System.out.println(this.model + " has stopped.");
32 | this.currentSpeed = 0;
33 | }
34 |
35 | public void showSpeed () {
36 | System.out.println("The current speed of " + this.model + " is : " + this.currentSpeed);
37 | }
38 |
39 | public String toString () {
40 | return "Model : " + this.model + " Color : " + this.color + " Year :" + this.year;
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/oopconcept/CarTest.java:
--------------------------------------------------------------------------------
1 | package oopconcept;
2 |
3 | public class CarTest {
4 |
5 | public static void main(String[] args) {
6 |
7 | Car myCar = new Car("Ferrari");
8 | myCar.start();
9 | myCar.accelerate();
10 | myCar.showSpeed();
11 | myCar.stop();
12 | myCar.showSpeed();
13 |
14 | Car myCar1 = new Car("Ferrari", "Red", 2015);
15 | System.out.println(myCar1); // calls toString() method in Car.
16 |
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/packageoperation/Add.java:
--------------------------------------------------------------------------------
1 | package packageoperation;
2 |
3 | public class Add {
4 |
5 | public int add (int a, int b) {
6 | return a + b;
7 | }
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/packageoperation/Multiply.java:
--------------------------------------------------------------------------------
1 | package packageoperation;
2 |
3 | public class Multiply {
4 |
5 | public int multiply (int a, int b) {
6 | return a * b;
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/packagetest/Test.java:
--------------------------------------------------------------------------------
1 | package packagetest;
2 |
3 | // Built-in package java.util
4 | import java.util.Scanner;
5 |
6 | // User-defined package
7 | import packageoperation.*;
8 |
9 | public class Test {
10 |
11 | public static void main(String[] args) {
12 |
13 | Scanner input = new Scanner(System.in);
14 | System.out.println("Please enter 2 integer numbers : ");
15 | int number1 = input.nextInt();
16 | int number2 = input.nextInt();
17 | Multiply obj = new Multiply();
18 | System.out.println("Result : " + obj.multiply(number1, number2));
19 |
20 | Add obj1 = new Add (); // no need to import
21 | System.out.println("Result : " + obj1.add(number1, number2));
22 |
23 |
24 |
25 |
26 |
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/polymorphism/Car.java:
--------------------------------------------------------------------------------
1 | package polymorphism;
2 |
3 | public class Car extends Vehicle {
4 |
5 | @Override
6 | public void accelerate () {
7 | System.out.println("Car is accelerating.");
8 | }
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/polymorphism/Motorcycle.java:
--------------------------------------------------------------------------------
1 | package polymorphism;
2 |
3 | public class Motorcycle extends Vehicle {
4 |
5 | @Override
6 | public void accelerate () {
7 | System.out.println("Motorcycle is accelerating.");
8 | }
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/polymorphism/Test.java:
--------------------------------------------------------------------------------
1 | package polymorphism;
2 |
3 | public class Test {
4 |
5 | public static void main(String[] args) {
6 |
7 | Vehicle vehicle = new Car ();
8 | // this works because Car is a subclass of Vehicle.
9 | vehicle.accelerate();
10 |
11 | Vehicle vehicle1 = new Motorcycle();
12 | vehicle1.accelerate();
13 |
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/polymorphism/Vehicle.java:
--------------------------------------------------------------------------------
1 | package polymorphism;
2 |
3 | public class Vehicle {
4 |
5 | public void accelerate () {
6 | System.out.println("Vehicle is accelerating.");
7 | }
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/staticexample/Car.java:
--------------------------------------------------------------------------------
1 | package staticexample;
2 |
3 | public class Car {
4 |
5 | public static int currentSpeed = 0;
6 | public static int maxSpeed = 180;
7 |
8 | public static void showCurrentSpeed (int speed) {
9 | System.out.println("Your current speed is : " + currentSpeed);
10 | }
11 | public static void speedUp (int increase) {
12 | currentSpeed +=increase;
13 | if (currentSpeed > maxSpeed) {
14 | showCurrentSpeed(currentSpeed);
15 | System.out.println("Please slow down!");
16 | }
17 | else {
18 | showCurrentSpeed(currentSpeed);
19 | }
20 | }
21 | public static void speedDown (int decrease) {
22 | currentSpeed -=decrease;
23 | showCurrentSpeed(currentSpeed);
24 | }
25 | public static void stop () {
26 | currentSpeed = 0;
27 | showCurrentSpeed(currentSpeed);
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/staticexample/Test.java:
--------------------------------------------------------------------------------
1 | package staticexample;
2 |
3 | public class Test {
4 |
5 | public static void main(String[] args) {
6 |
7 | Car.speedUp(60);
8 | Car.speedUp(160);
9 | Car.speedDown(50);
10 | Car.stop();
11 |
12 | Car obj = new Car();
13 | obj.speedUp(40);
14 |
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/superthis/Car.java:
--------------------------------------------------------------------------------
1 | package superthis;
2 |
3 | public class Car extends Vehicle {
4 |
5 | boolean isAutomatic = false;
6 |
7 | public Car(String type, String model, int maxSpeed, boolean isAutomatic){
8 | super(type, model, maxSpeed); // super class constructor calling
9 | this.isAutomatic = isAutomatic;
10 | }
11 |
12 | // getter method
13 | public boolean isAutomatic() {
14 | return isAutomatic;
15 | }
16 |
17 |
18 |
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/superthis/SuperThisTest.java:
--------------------------------------------------------------------------------
1 | package superthis;
2 |
3 | public class SuperThisTest {
4 |
5 | public static void main(String[] args) {
6 |
7 | // Creating Car object
8 |
9 | Car car = new Car("Car", "Ferrari", 320, true);
10 | System.out.println("Type : " + car.getType());
11 | System.out.println("Model : " + car.getModel());
12 | System.out.println("Max Speed : " + car.getMaxSpeed());
13 | System.out.println("Is Car automatic ? " + car.isAutomatic());
14 |
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/Core/ObjectOrientedProgramming/src/superthis/Vehicle.java:
--------------------------------------------------------------------------------
1 | package superthis;
2 |
3 | public class Vehicle {
4 |
5 | String type, model;
6 | int maxSpeed;
7 |
8 | // constructor
9 | public Vehicle (String type, String model, int maxSpeed) {
10 | this.type = type;
11 | this.model = model;
12 | this.maxSpeed = maxSpeed;
13 | }
14 |
15 | // getter methods
16 | public String getType() {
17 | return type;
18 | }
19 |
20 | public String getModel() {
21 | return model;
22 | }
23 |
24 | public int getMaxSpeed() {
25 | return maxSpeed;
26 | }
27 |
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/Core/String/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Core/String/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | String
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Core/String/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=10
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=10
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.release=enabled
12 | org.eclipse.jdt.core.compiler.source=10
13 |
--------------------------------------------------------------------------------
/Core/String/bin/string/ReverseString.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/String/bin/string/ReverseString.class
--------------------------------------------------------------------------------
/Core/String/bin/string/StringExample.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/String/bin/string/StringExample.class
--------------------------------------------------------------------------------
/Core/String/bin/string/StringMethod.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/String/bin/string/StringMethod.class
--------------------------------------------------------------------------------
/Core/String/bin/stringbuffer/StringBufferExample.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/String/bin/stringbuffer/StringBufferExample.class
--------------------------------------------------------------------------------
/Core/String/bin/stringbuilder/StringBuilderExample.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OakAcademy/Java/504bc1fbad75af7817f9e5c0dd4b5627f422274c/Core/String/bin/stringbuilder/StringBuilderExample.class
--------------------------------------------------------------------------------
/Core/String/src/string/ReverseString.java:
--------------------------------------------------------------------------------
1 | package string;
2 |
3 | import java.util.Scanner;
4 |
5 | public class ReverseString {
6 |
7 | public static void main(String[] args) {
8 |
9 | Scanner input = new Scanner(System.in);
10 | System.out.println("Enter a string : ");
11 | String string = input.nextLine();
12 | int length = string.length();
13 |
14 | String reversedString = "";
15 | for (int i = length -1 ; i>=0;i--) {
16 | reversedString = reversedString + string.charAt(i);
17 | }
18 |
19 | System.out.println("Reversed String is : " + reversedString);
20 | input.close();
21 |
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/Core/String/src/string/StringExample.java:
--------------------------------------------------------------------------------
1 | package string;
2 |
3 | public class StringExample {
4 |
5 | public static void main(String[] args) {
6 |
7 | String s = "Java Programming";
8 | String s1 = "Java Programming";
9 |
10 | String sobj = new String ("Java Programming");
11 | String sobj1 = new String ("Java Programming");
12 |
13 | System.out.println(s);
14 | System.out.println(s1);
15 | System.out.println(sobj);
16 | System.out.println(sobj1);
17 |
18 | /*
19 | * '==' operator matches the references
20 | * equals() method matches values or contents
21 | */
22 | System.out.println("s == s1 : " + (s == s1));
23 | System.out.println("s == sobj : " + (s == sobj));
24 | System.out.println("s.equals(s1) : " + (s.equals(s1)));
25 | System.out.println("s.equals(sobj) : " + (s.equals(sobj)));
26 | System.out.println("sobj == sobj1 : " + (sobj == sobj1));
27 | System.out.println("sobj.equals(sobj1) : " + (sobj.equals(sobj1)));
28 |
29 |
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/Core/String/src/string/StringMethod.java:
--------------------------------------------------------------------------------
1 | package string;
2 |
3 | public class StringMethod {
4 |
5 | public static void main(String[] args) {
6 |
7 | String s1 = "Java Programming Language";
8 | String s2 = " Hello";
9 | String s3[];
10 |
11 | System.out.println("String : " + s1);
12 | System.out.println("The first character : " + s1.charAt(0));
13 | System.out.println("Length of string : " + s1.length());
14 | System.out.println("Substring : " + s1.substring(5));
15 | System.out.println("Is equal : " + s1.equals(s2));
16 | System.out.println("Is empty : " + s1.isEmpty());
17 | System.out.println("Concat : " + s1.concat(s2));
18 | System.out.println("Uppercase : " + s1.toUpperCase());
19 | System.out.println("Lowercase : " + s1.toLowerCase());
20 | // split() method
21 | s3 = s1.split(" ");
22 | for (String string : s3) {
23 | System.out.print(string);
24 | }
25 | // replace() method
26 | System.out.println("\nReplace v, V : " + s1.replace('v', 'V'));
27 |
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/Core/String/src/stringbuffer/StringBufferExample.java:
--------------------------------------------------------------------------------
1 | package stringbuffer;
2 |
3 | public class StringBufferExample {
4 |
5 | public static void main(String[] args) {
6 |
7 | StringBuffer buffer = new StringBuffer("Welcome to");
8 | buffer.append(" Java"); // mutable buffer object
9 | // buffer object points out "Welcome to Java"
10 | System.out.println(buffer);
11 | System.out.println(buffer.length());
12 | System.out.println(buffer.insert(buffer.length(), " World"));
13 | System.out.println(buffer.reverse());
14 | System.out.println(buffer.reverse());
15 | System.out.println(buffer.delete(0, 11));
16 |
17 |
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/Core/String/src/stringbuilder/StringBuilderExample.java:
--------------------------------------------------------------------------------
1 | package stringbuilder;
2 |
3 | public class StringBuilderExample {
4 |
5 | public static void main(String[] args) {
6 |
7 | StringBuilder builder = new StringBuilder("Welcome to");
8 | builder.append(" Java"); // mutable builder object
9 | // builder object points out "Welcome to Java"
10 | System.out.println(builder);
11 | System.out.println(builder.length());
12 | System.out.println(builder.insert(builder.length(), " World"));
13 | System.out.println(builder.reverse());
14 | System.out.println(builder.reverse());
15 | System.out.println(builder.delete(0, 11));
16 |
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------