├── .gitattributes ├── src ├── exercises │ ├── questionsANDanswers │ │ ├── replit │ │ │ ├── replitNotes │ │ │ ├── oop │ │ │ │ ├── TJMaxxItem.java │ │ │ │ └── LameCalculatorClass.java │ │ │ ├── basics │ │ │ │ ├── FixCode.java │ │ │ │ ├── HelloWorld_2.java │ │ │ │ ├── HelloWorld_1.java │ │ │ │ ├── Cool.java │ │ │ │ ├── PrintVariable_1.java │ │ │ │ ├── PrintName.java │ │ │ │ └── PrintVariable_2.java │ │ │ └── variables │ │ │ │ └── Primitives_1.java │ │ ├── Notes.java │ │ ├── qa02_test02 │ │ │ ├── Question_19.java │ │ │ ├── Question_23.java │ │ │ ├── Question_03.java │ │ │ ├── Question_16.java │ │ │ ├── Question_10.java │ │ │ ├── Question_04.java │ │ │ ├── Question_12.java │ │ │ ├── Question_20.java │ │ │ ├── Question_25.java │ │ │ ├── Question_14.java │ │ │ ├── Question_15.java │ │ │ ├── Question_29.java │ │ │ ├── Question_05.java │ │ │ ├── Question_17.java │ │ │ ├── Question_07.java │ │ │ ├── Question_02.java │ │ │ ├── Question_11.java │ │ │ ├── Question_08.java │ │ │ ├── Question_13.java │ │ │ ├── Question_18.java │ │ │ ├── Question_06.java │ │ │ └── Question_21.java │ │ ├── qa01_print_and_println │ │ │ ├── Question_04.java │ │ │ ├── Question_02.java │ │ │ ├── Question_01.java │ │ │ ├── Question_07.java │ │ │ ├── Question_03.java │ │ │ └── Question_05.java │ │ ├── qa01_test01 │ │ │ ├── Question_03.java │ │ │ ├── Question_26.java │ │ │ ├── Question_25.java │ │ │ ├── Question_10.java │ │ │ ├── Question_01.java │ │ │ ├── Question_15.java │ │ │ ├── Question_07.java │ │ │ ├── Question_14.java │ │ │ ├── Question_16.java │ │ │ ├── Question_24.java │ │ │ ├── Question_02.java │ │ │ ├── Question_06.java │ │ │ ├── Question_17.java │ │ │ ├── Question_23.java │ │ │ ├── Question_05.java │ │ │ ├── Question_12.java │ │ │ ├── Question_13.java │ │ │ ├── Question_04.java │ │ │ ├── Question_09.java │ │ │ ├── Question_21.java │ │ │ ├── Question_22.java │ │ │ └── Question_28.java │ │ ├── qa05_nestedLoops │ │ │ └── Question_6.java │ │ ├── qa04_loops │ │ │ ├── Question_01.java │ │ │ ├── Question_05.java │ │ │ ├── Question_02.java │ │ │ ├── Question_03.java │ │ │ ├── Question_10.java │ │ │ └── Question_14.java │ │ └── qa02_variables │ │ │ ├── Question_01.java │ │ │ ├── Question_02.java │ │ │ ├── Question_07.java │ │ │ └── Question_03.java │ ├── shorts │ │ ├── _38_abstractionTest │ │ │ ├── Shape.java │ │ │ ├── Square.java │ │ │ ├── Rectangle.java │ │ │ └── Circle.java │ │ ├── _42_OOP_Polymorphism_Test │ │ │ ├── Shape.java │ │ │ ├── VolumeInterface.java │ │ │ ├── Cube.java │ │ │ ├── Cylinder.java │ │ │ ├── Square.java │ │ │ ├── Rectangle.java │ │ │ └── Circle.java │ │ ├── _40_Abstraction_INTERFACE_Test │ │ │ ├── Shape.java │ │ │ ├── VolumeInterface.java │ │ │ ├── Cube.java │ │ │ ├── Cylinder.java │ │ │ ├── Square.java │ │ │ ├── Rectangle.java │ │ │ └── Circle.java │ │ ├── _30_singleInheritence.java │ │ ├── _33_methodOverridingTest │ │ │ ├── Shape.java │ │ │ ├── Square.java │ │ │ ├── Circle.java │ │ │ └── Rectangle.java │ │ ├── _28_Inheritence │ │ │ ├── Dog.java │ │ │ ├── Fish.java │ │ │ └── Cat.java │ │ ├── _31_hierarchicalInheritance.java │ │ ├── _25_staticBlockTest.java │ │ ├── _29_superKeywordTest │ │ │ ├── Dog.java │ │ │ └── Cat.java │ │ ├── _23_constructorsThisKeywordTest │ │ │ └── EmployeeObject.java │ │ ├── _22_classObject │ │ │ └── DogClassObject.java │ │ ├── _26_accessModifier_01 │ │ │ └── AccessModifier.java │ │ ├── _36_throwsKeyword.java │ │ ├── _23_constructorsThisKeyword.java │ │ └── _26_accessModifiers.java │ ├── Notes.java │ └── interview_exercises │ │ ├── number_tasks │ │ ├── Number_Fibonacci.java │ │ ├── Number_ReverseInteger.java │ │ ├── Number_Armstrong.java │ │ ├── Number_Prime.java │ │ ├── Number_SumOfDigitsOfInteger.java │ │ ├── Number_FactorialNumber.java │ │ └── Number_DivideWithoutDivision.java │ │ ├── array_tasks │ │ ├── Array_Reverse.java │ │ ├── Array_FindMinimum.java │ │ ├── Array_FindMaximum.java │ │ ├── Array_MoveAllZerosToTheEnd.java │ │ └── Array_MergeTwoArrays.java │ │ └── string_tasks │ │ ├── String_Reverse.java │ │ └── String_RemoveDuplicates.java ├── reviews │ ├── review03 │ │ ├── Week3Notes.txt │ │ ├── TernaryExample.java │ │ ├── BasicLoopExamples.java │ │ ├── CustomMethod2.java │ │ ├── CustomMethod3.java │ │ ├── PrintAllLetters.java │ │ └── CustomMethods1.java │ ├── review11 │ │ ├── exercise_example │ │ │ ├── Lifting.java │ │ │ ├── Exercise.java │ │ │ ├── Running.java │ │ │ ├── Swimming.java │ │ │ ├── AtTheGym.java │ │ │ └── FreeWeight.java │ │ ├── car_examples │ │ │ ├── Tesla.java │ │ │ ├── BMW.java │ │ │ ├── Toyota.java │ │ │ ├── ParkingLot.java │ │ │ └── Car.java │ │ └── FinalKeyword.java │ ├── review09 │ │ ├── inheritance │ │ │ ├── Book.java │ │ │ ├── Ebook.java │ │ │ ├── AudioBook.java │ │ │ └── BookObjects.java │ │ └── StaticTest.java │ ├── review12 │ │ ├── polymorphism_demo │ │ │ ├── Worker.java │ │ │ ├── Superman.java │ │ │ └── Father.java │ │ └── interface_demo │ │ │ └── WebDriver.java │ ├── review04 │ │ ├── ImportExample.java │ │ ├── LocalVsInstance.java │ │ ├── BankAccount.java │ │ ├── TestCase.java │ │ ├── SalaryTest.java │ │ ├── GarbageExample.java │ │ ├── AmazonTest_2.java │ │ ├── CalculatorOverLoading.java │ │ ├── LocalVsInstanceTest.java │ │ └── ScrumTeam.java │ ├── review08 │ │ ├── testEnvironment │ │ │ ├── TestEnvironment.java │ │ │ ├── OS.java │ │ │ └── Browser.java │ │ ├── Login.java │ │ └── Employee.java │ ├── review07 │ │ └── Products.java │ ├── review13 │ │ ├── customExceptions │ │ │ ├── BreakTimeException.java │ │ │ └── CustomExceptionTest.java │ │ ├── StringIndexProblem.java │ │ └── FinallyBlock.java │ ├── review02 │ │ ├── EvenorOdd.java │ │ └── RelationalOperators.java │ ├── review10 │ │ ├── SupportPersonel.java │ │ ├── Tester.java │ │ ├── Developer.java │ │ └── AmazonInc.java │ ├── review01 │ │ ├── TellMeAboutYourself.java │ │ ├── PrintStatements.java │ │ ├── CarInfo.java │ │ └── Shapes.java │ ├── review06 │ │ ├── QuizQ4.java │ │ └── A07_SentenceSplit.java │ └── review05 │ │ ├── S04_IndexOfExample.java │ │ └── S09_FrequencyOfWord.java ├── oop │ ├── OopNotes.java │ ├── JOOP43_Polymorphism │ │ ├── AppleDevice.java │ │ ├── Shape.java │ │ ├── Triangle.java │ │ ├── Square.java │ │ ├── Circle.java │ │ ├── Ipad.java │ │ ├── Mac.java │ │ └── AppleWatch.java │ ├── JOOP41_Abstraction │ │ └── Practice │ │ │ ├── Phone.java │ │ │ ├── MobilePhone.java │ │ │ ├── IphoneX.java │ │ │ ├── Iphone.java │ │ │ └── Nokia.java │ ├── JOOP38_InheritanceContinue │ │ ├── OOP14_Vehicle.java │ │ ├── OOP17_Person.java │ │ ├── OOP10_Employee.java │ │ ├── OOP19_StudentTest.java │ │ ├── OOP12_Contractor.java │ │ ├── OOP16_CarTest.java │ │ ├── OOP06_DogTest.java │ │ ├── OOP11_FullTimeEmployee.java │ │ ├── OOP18_Student.java │ │ ├── OOP08_StaticSub.java │ │ ├── OOP01_SuperClass.java │ │ ├── OOP02_SubClass.java │ │ └── OOP07_StaticSuper.java │ ├── JOOP40_AccessModifiers_FinalKeyword_MethodHiding │ │ ├── Parent.java │ │ ├── Rodent.java │ │ ├── Marsupial.java │ │ ├── Mouse.java │ │ ├── Car.java │ │ ├── Kangroo.java │ │ ├── CarTest.java │ │ └── MethodHidingTestKangroo.java │ ├── JOOP34_Constructors_PassingObjectsToMethods │ │ ├── OOP03_Apple.java │ │ ├── OOP02_LightTest.java │ │ ├── OOP05_Dice.java │ │ └── OOP05_DiceTest.java │ ├── JOOP36_StaticClassMembers │ │ ├── OOP10_Abc.java │ │ ├── OOP05_Dinner.java │ │ ├── OOP03_Countable.java │ │ ├── OOP14_StaticImport.java │ │ ├── OOP16_AllBlocksTest.java │ │ └── OOP17_Car.java │ ├── JOOP33_Class_Objects_Constructors │ │ ├── OOP09_MouseTest.java │ │ └── OOP02_RectangleClass.java │ ├── JOOP45_ExceptionsAndErrorHandling │ │ ├── Ex01_BadArray.java │ │ ├── Ex08_CheckedVsUnChecked.java │ │ ├── Ex09_OrCatchBlock.java │ │ └── Ex05_TryCatchFinally.java │ ├── JOOP39_Inheritance_AccessModifiers │ │ └── OOP04_ToyotaTest.java │ ├── JOOP37_Inheritance │ │ ├── OOP03_Employee.java │ │ ├── OOP02_Student.java │ │ └── OOP01_Person.java │ ├── JOOP42_Interface │ │ └── Vehicle.java │ └── JOOP35_Encapsulation │ │ └── OOP04_CarpetTest.java ├── core │ ├── JC14_methods_Part_2 │ │ ├── JC11_valueReturn.java │ │ ├── JC07_task_62_calculateGreatest.java │ │ ├── JC08_task_63_fahrenheitToCelciusConverter.java │ │ ├── JC09_task_64_starPatterns.java │ │ └── JC12_task_66_distanceTraveled.java │ ├── reviews │ │ ├── notes.java │ │ ├── week_01 │ │ │ ├── end_of_the_week_Notes.java │ │ │ ├── _01_notes.java │ │ │ ├── _05_tellMeAboutYourSelf.java │ │ │ ├── _02_printStatements.java │ │ │ └── _08_carInfo.java │ │ ├── week_04 │ │ │ ├── _12_local_Vs_Instance_Variables.java │ │ │ ├── _18_importExample.java │ │ │ ├── _14_bankAccount.java │ │ │ ├── _19_testCase.java │ │ │ ├── _11_salaryTest.java │ │ │ ├── _16_garbageExample.java │ │ │ └── _02_amazonTest_2.java │ │ ├── week_07 │ │ │ └── Products.java │ │ ├── week_02 │ │ │ └── evenorOdd.java │ │ ├── week_03 │ │ │ ├── _02_basicLoopExamples.java │ │ │ ├── _01_ternaryExample.java │ │ │ └── customMethod.java │ │ └── week_06 │ │ │ └── _13_QuizExample.java │ ├── JC28_Arrays_Part_5 │ │ └── JC01_Arrays.java │ ├── JC29_Arrays_Part_6 │ │ └── JC_Arrays_Part_6.java │ ├── JC09_controlFlowStatements_Part_3 │ │ ├── JC00_Assngmnt.java │ │ ├── JC06_ifElseRules.java │ │ └── JC04_task_39_switchCase.java │ ├── JC05_unaryAssignmentRelationalLogicalOperators │ │ ├── JC05_task_21_unaryOperators.java │ │ └── JC04_task_20_unaryOperators.java │ ├── JC13_methods_Part_1 │ │ ├── JC01_methodsNotes.java │ │ ├── JC08_task_56_convertKM.java │ │ ├── JC09_task_57_sumOfNumbers.java │ │ ├── JC12_passMultipleArguments.java │ │ ├── JC11_passArguments.java │ │ ├── JC03_simpleMethod.java │ │ ├── JC15_task_61_ageCalculator.java │ │ ├── JC13_task_59_payCalculator.java │ │ ├── JC05_loopCallMethod.java │ │ ├── JC10_task_58_greaterNumber.java │ │ ├── JC02_studentMethod.java │ │ └── JC07_deepAndDeeper.java │ ├── JC12_branchingStatements │ │ ├── JC01_breakContinue.java │ │ └── JC03_labeledStatements.java │ ├── JC15_methodOverloading │ │ └── JC08_methodOverloading_2.java │ ├── JC03_variables_dataTypes │ │ ├── JC11_task_11_variablesDataTypes.java │ │ ├── JC05_task_05_variablesDataTypes.java │ │ ├── JC10_task_10_variablesDataTypes.java │ │ └── JC07_task_07_variablesDataTypes.java │ ├── JC11_controlFlowStatements_Part_5 │ │ ├── JC04_task_47_nestedForLoops.java │ │ ├── JC05_task_48_nestedForLoops.java │ │ ├── JC07_task_50_nestedForLoops.java │ │ ├── JC06_task_49_nestedForLoops.java │ │ ├── JC11_task_52_whileLoops.java │ │ ├── JC03_nestedForLoopsTwo.java │ │ └── JC02_nestedForLoop.java │ ├── JC16_classObjects │ │ ├── JC01_dogClass.java │ │ ├── JC03_task_cellPhoneClass.java │ │ ├── JC04_task_contactClass.java │ │ └── JC05_task_employeeClass.java │ ├── JC25_Arrays_Part_2 │ │ ├── JC06_PassElements.java │ │ └── JC05_sameArray.java │ ├── JC10_controlFlowStatements_Part_4 │ │ ├── JC03_task_40_forLoop_evenNumbers.java │ │ ├── JC04_task_41_forLoop_oddNumbers.java │ │ └── JC06_task_43_forLoop_printTable.java │ ├── JC18_readingUserInput │ │ ├── JC02_userInput_2.java │ │ └── JC05_task_72_sumNumbers.java │ ├── JC24_Arrays_Part_1 │ │ └── JC06_task_89_ShoppingList.java │ ├── JC02_printingComments │ │ ├── JC03_task_01_triangle.java │ │ └── JC08_commenting.java │ ├── JC21_stringClass_stringManipulation_Part_03 │ │ └── JC02_String_toLowerCase.java │ ├── JC27_Arrays_Part_4 │ │ ├── JC04_loop2DArray.java │ │ └── JC06_NestedForEachLoopIn2DArray.java │ ├── JC07_controlFlowStatements_if_ifElse_Part_1 │ │ ├── JC06_smallTasks_task_5_ifStatement2.java │ │ ├── JC13_ifElseStatement2.java │ │ ├── JC02_smallTasks_task_1_ifStatement2.java │ │ ├── JC04_smallTasks_task_3_ifStatement2.java │ │ ├── JC03_smallTasks_task_2_ifStatement2.java │ │ └── JC05_smallTasks_task_4_ifStatement2.java │ ├── JC06_logicalOperators │ │ └── JC04_task_unNumbered_3_logicalOperators.java │ ├── JC19_stringClass_stringManipulation_Part_01 │ │ └── JC04_task_76_printingEachCharacters.java │ ├── JavaCoreNotes.java │ └── JC04_arithmethicOperators │ │ └── JC08_task_15_convertMileToKilometer.java └── NewYear.java ├── 2021 Java Developer RoadMap.png └── .gitignore /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/replit/replitNotes: -------------------------------------------------------------------------------- 1 | Replit Java Questions and answers for exercise -------------------------------------------------------------------------------- /2021 Java Developer RoadMap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esalkan/Java-Core-Oop-Road-Map/HEAD/2021 Java Developer RoadMap.png -------------------------------------------------------------------------------- /src/reviews/review03/Week3Notes.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/esalkan/Java-Core-Oop-Road-Map/HEAD/src/reviews/review03/Week3Notes.txt -------------------------------------------------------------------------------- /src/exercises/shorts/_38_abstractionTest/Shape.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._38_abstractionTest; 2 | 3 | public abstract class Shape { 4 | public abstract double area(); 5 | } 6 | -------------------------------------------------------------------------------- /src/exercises/shorts/_42_OOP_Polymorphism_Test/Shape.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._42_OOP_Polymorphism_Test; 2 | 3 | public abstract class Shape { 4 | public abstract double area(); 5 | } 6 | -------------------------------------------------------------------------------- /src/reviews/review11/exercise_example/Lifting.java: -------------------------------------------------------------------------------- 1 | package reviews.review11.exercise_example; 2 | 3 | public abstract class Lifting extends Exercise{ 4 | 5 | public abstract void endLift(); 6 | } 7 | -------------------------------------------------------------------------------- /src/exercises/shorts/_40_Abstraction_INTERFACE_Test/Shape.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._40_Abstraction_INTERFACE_Test; 2 | 3 | public abstract class Shape { 4 | public abstract double area(); 5 | } 6 | -------------------------------------------------------------------------------- /src/reviews/review09/inheritance/Book.java: -------------------------------------------------------------------------------- 1 | package reviews.review09.inheritance; 2 | 3 | public class Book { 4 | 5 | String title; 6 | String type; 7 | String author; 8 | double price; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/reviews/review12/polymorphism_demo/Worker.java: -------------------------------------------------------------------------------- 1 | package reviews.review12.polymorphism_demo; 2 | 3 | public interface Worker { 4 | 5 | void work(String job); 6 | 7 | double getPaid(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/oop/OopNotes.java: -------------------------------------------------------------------------------- 1 | package oop; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | 8 | public class OopNotes { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/exercises/Notes.java: -------------------------------------------------------------------------------- 1 | package exercises; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Notes { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/exercises/shorts/_30_singleInheritence.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts; 2 | 3 | // Parent/super Class 4 | class Device{ } 5 | 6 | // One single sub/child class 7 | class Phone extends Device{ } 8 | 9 | public class _30_singleInheritence { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/replit/oop/TJMaxxItem.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.replit.oop; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class TJMaxxItem { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/exercises/shorts/_33_methodOverridingTest/Shape.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._33_methodOverridingTest; 2 | 3 | public class Shape { 4 | 5 | public double area() { 6 | return 0; 7 | } 8 | 9 | public double perimeter() { 10 | return 0; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/oop/JOOP43_Polymorphism/AppleDevice.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP43_Polymorphism; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public abstract class AppleDevice { 8 | public abstract void use(); 9 | } 10 | -------------------------------------------------------------------------------- /src/exercises/shorts/_28_Inheritence/Dog.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._28_Inheritence; 2 | 3 | public class Dog extends Animal{ 4 | 5 | // Special feature for DOG just dog can bark 6 | public void bark(){ 7 | System.out.println(name + " is barking"); 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/exercises/shorts/_28_Inheritence/Fish.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._28_Inheritence; 2 | 3 | public class Fish extends Animal{ 4 | 5 | // Special just for FISH 6 | public void liveUnderWater(){ 7 | System.out.println(name + " is swimming under the water"); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/exercises/shorts/_42_OOP_Polymorphism_Test/VolumeInterface.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._42_OOP_Polymorphism_Test; 2 | 3 | public interface VolumeInterface { 4 | 5 | boolean hasVolume = true; // static & final By default 6 | 7 | double volume(); // Abstract Method. By default 8 | } 9 | -------------------------------------------------------------------------------- /src/reviews/review04/ImportExample.java: -------------------------------------------------------------------------------- 1 | package reviews.review04; 2 | 3 | import reviews.review03.CustomMethod3; 4 | 5 | public class ImportExample { 6 | 7 | public static void main(String[] args) { 8 | 9 | System.out.println(CustomMethod3.getAgeInDays(35)); 10 | 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/oop/JOOP41_Abstraction/Practice/Phone.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP41_Abstraction.Practice; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public abstract class Phone { 8 | 9 | public abstract void call(); 10 | } 11 | -------------------------------------------------------------------------------- /src/exercises/shorts/_40_Abstraction_INTERFACE_Test/VolumeInterface.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._40_Abstraction_INTERFACE_Test; 2 | 3 | public interface VolumeInterface { 4 | 5 | boolean hasVolume = true; // static & final By default 6 | 7 | double volume(); // Abstract Method. By default 8 | } 9 | -------------------------------------------------------------------------------- /src/reviews/review08/testEnvironment/TestEnvironment.java: -------------------------------------------------------------------------------- 1 | package reviews.review08.testEnvironment; 2 | 3 | public class TestEnvironment { 4 | 5 | Browser browser; 6 | OS os; 7 | 8 | 9 | public String toString() { 10 | 11 | return browser.getBrowserType()+" | "+os.getOs(); 12 | 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/oop/JOOP41_Abstraction/Practice/MobilePhone.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP41_Abstraction.Practice; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public abstract class MobilePhone extends Phone { 9 | public abstract void text(); 10 | } 11 | -------------------------------------------------------------------------------- /src/reviews/review04/LocalVsInstance.java: -------------------------------------------------------------------------------- 1 | package reviews.review04; 2 | 3 | public class LocalVsInstance { 4 | 5 | int a = 20; // instance variable 6 | 7 | 8 | public void showDifference() { 9 | int a =5; // local variable 10 | System.out.println(a); 11 | } 12 | 13 | 14 | 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/oop/JOOP43_Polymorphism/Shape.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP43_Polymorphism; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class Shape { 8 | 9 | public void draw(){ 10 | System.out.println("Drawing a shape"); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/reviews/review12/interface_demo/WebDriver.java: -------------------------------------------------------------------------------- 1 | package reviews.review12.interface_demo; 2 | 3 | public interface WebDriver { 4 | // these are all abstract method with no Return or vith return 5 | void get (String url); // public abstract 6 | void findElement(String locator); 7 | void quit(); 8 | String getTitle(); 9 | 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/reviews/review04/BankAccount.java: -------------------------------------------------------------------------------- 1 | package reviews.review04; 2 | 3 | public class BankAccount { 4 | 5 | String accountHolderName; 6 | int pin; 7 | double balance; 8 | long accountNumber; 9 | 10 | public double getBalance(int inputPin) { 11 | if(pin==inputPin) { 12 | return balance; 13 | } 14 | return -1; 15 | } 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/oop/JOOP38_InheritanceContinue/OOP14_Vehicle.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP38_InheritanceContinue; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP14_Vehicle { 9 | 10 | // Create an instance Variable and assing the value 11 | int maxSpeed = 120; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/oop/JOOP38_InheritanceContinue/OOP17_Person.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP38_InheritanceContinue; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP17_Person { 9 | 10 | public void message() { 11 | System.out.println("This is person class"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/reviews/review11/exercise_example/Exercise.java: -------------------------------------------------------------------------------- 1 | package reviews.review11.exercise_example; 2 | 3 | public abstract class Exercise { 4 | 5 | public void start() { 6 | System.out.println("Warming up and starting the exercise"); 7 | } 8 | 9 | public abstract void perform(); 10 | 11 | public abstract int getCaloriesCount(int minutes); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/core/JC14_methods_Part_2/JC11_valueReturn.java: -------------------------------------------------------------------------------- 1 | package core.JC14_methods_Part_2; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC11_valueReturn { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | 14 | 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/oop/JOOP43_Polymorphism/Triangle.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP43_Polymorphism; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class Triangle extends Shape { 8 | 9 | @Override 10 | public void draw(){ 11 | System.out.println("Drawing a Triangle"); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/reviews/review07/Products.java: -------------------------------------------------------------------------------- 1 | package reviews.review07; 2 | 3 | public class Products { 4 | 5 | String name; 6 | double price; 7 | 8 | public void setInfo(String n, double d) { 9 | name = n; 10 | price = d; 11 | } 12 | 13 | 14 | public String toString() { 15 | return "Products [name=" + name + ", price=" + price + "]"; 16 | } 17 | 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/reviews/review11/car_examples/Tesla.java: -------------------------------------------------------------------------------- 1 | package reviews.review11.car_examples; 2 | 3 | public final class Tesla extends Car { 4 | 5 | public Tesla(String model, String color, int year) { 6 | super(model,color, year); 7 | super.make = "Tesla"; 8 | } 9 | 10 | 11 | public void start() { 12 | 13 | System.out.println("Say start"); 14 | 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/Notes.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | *//** 8 | * @project Java Core & OOP Notes 9 | * @author esalkan 10 | * @github https://github.com/esalkan/java-notes 11 | */ 12 | public class Notes { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/exercises/shorts/_31_hierarchicalInheritance.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts; 2 | 3 | // Super Class 4 | class Animal{ } 5 | 6 | // SubClass of Animal 7 | class Dog extends Animal{} 8 | 9 | // SubClass of Animal 10 | class Cat extends Animal{} 11 | 12 | // SubClass of Animal 13 | class Fish extends Animal{} 14 | 15 | 16 | public class _31_hierarchicalInheritance { 17 | } 18 | -------------------------------------------------------------------------------- /src/oop/JOOP43_Polymorphism/Square.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP43_Polymorphism; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class Square extends Shape{ 8 | @Override 9 | public void draw(){ 10 | // super.draw(); 11 | System.out.println("Drawing a Square"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/core/reviews/notes.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package core.reviews; 5 | 6 | /** 7 | * @project Java Core & OOP Notes 8 | * @author esalkan 9 | * @github https://github.com/esalkan/java-notes 10 | */ 11 | public class notes { 12 | 13 | /** 14 | * @param args 15 | */ 16 | public static void main(String[] args) { 17 | // TODO Auto-generated method stub 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/oop/JOOP40_AccessModifiers_FinalKeyword_MethodHiding/Parent.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP40_AccessModifiers_FinalKeyword_MethodHiding; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | 9 | public class Parent { 10 | public int x = 100; 11 | 12 | public void increment() { 13 | x++; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/reviews/review11/car_examples/BMW.java: -------------------------------------------------------------------------------- 1 | package reviews.review11.car_examples; 2 | 3 | public class BMW extends Car { 4 | 5 | public BMW(String model, String make, String color, int year) { 6 | super(model,color, year); 7 | super.make = make; 8 | } 9 | 10 | @Override 11 | public void start() { 12 | 13 | System.out.println("Push the start button"); 14 | 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/reviews/review11/exercise_example/Running.java: -------------------------------------------------------------------------------- 1 | package reviews.review11.exercise_example; 2 | 3 | public class Running extends Exercise{ 4 | 5 | @Override 6 | public void perform() { 7 | // TODO Auto-generated method stub 8 | 9 | } 10 | 11 | @Override 12 | public int getCaloriesCount(int minutes) { 13 | // TODO Auto-generated method stub 14 | return 0; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/reviews/review11/exercise_example/Swimming.java: -------------------------------------------------------------------------------- 1 | package reviews.review11.exercise_example; 2 | 3 | public class Swimming extends Exercise{ 4 | 5 | @Override 6 | public void perform() { 7 | // TODO Auto-generated method stub 8 | 9 | } 10 | 11 | @Override 12 | public int getCaloriesCount(int minutes) { 13 | // TODO Auto-generated method stub 14 | return 0; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/oop/JOOP34_Constructors_PassingObjectsToMethods/OOP03_Apple.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP34_Constructors_PassingObjectsToMethods; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP03_Apple { 9 | 10 | String color = "Red"; 11 | 12 | public void mA() { 13 | System.out.println(color); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/oop/JOOP43_Polymorphism/Circle.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP43_Polymorphism; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class Circle extends Shape{ 8 | 9 | @Override 10 | public void draw() { 11 | // super.draw(); 12 | System.out.println("Drawing a Circle"); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/reviews/review04/TestCase.java: -------------------------------------------------------------------------------- 1 | package reviews.review04; 2 | 3 | public class TestCase { 4 | 5 | // P.I.Q.: How Do You write a Test Case? 6 | 7 | String testCaseID; 8 | String testCaseDescription; 9 | int numberOfTestSteps; 10 | boolean isPassed; 11 | 12 | // HW : create more attributes and some actions 13 | // create a class with main method and create objects of TestCases 14 | } 15 | -------------------------------------------------------------------------------- /src/core/JC28_Arrays_Part_5/JC01_Arrays.java: -------------------------------------------------------------------------------- 1 | package core.JC28_Arrays_Part_5; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class JC01_Arrays { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // TODO Auto-generated method stub 15 | 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_19.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_19 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/exercises/shorts/_28_Inheritence/Cat.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._28_Inheritence; 2 | 3 | public class Cat extends Animal{ 4 | 5 | // Special just for CAT 6 | public void meow(){ 7 | System.out.println(name + " is meow now"); 8 | } 9 | 10 | // Special just for CAT 11 | public void scratch(){ 12 | System.out.println(name + " is scratch"); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/oop/JOOP41_Abstraction/Practice/IphoneX.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP41_Abstraction.Practice; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class IphoneX extends Iphone { 9 | // no required to override anything. because In Iphone Class is not abstract 10 | // class and it can not have any abstract methods. 11 | } 12 | -------------------------------------------------------------------------------- /src/reviews/review11/exercise_example/AtTheGym.java: -------------------------------------------------------------------------------- 1 | package reviews.review11.exercise_example; 2 | 3 | public class AtTheGym { 4 | 5 | public static void main(String[] args) { 6 | 7 | FreeWeight freeWeight = new FreeWeight(); 8 | 9 | freeWeight.start(); 10 | System.out.println("I lifted weight for 30 minutes : " 11 | + freeWeight.getCaloriesCount(30) + "Calories"); 12 | 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/core/JC29_Arrays_Part_6/JC_Arrays_Part_6.java: -------------------------------------------------------------------------------- 1 | package core.JC29_Arrays_Part_6; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class JC_Arrays_Part_6 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // TODO Auto-generated method stub 15 | 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/core/reviews/week_01/end_of_the_week_Notes.java: -------------------------------------------------------------------------------- 1 | package core.reviews.week_01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class end_of_the_week_Notes { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // TODO Auto-generated method stub 15 | 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/oop/JOOP36_StaticClassMembers/OOP10_Abc.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP36_StaticClassMembers; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP10_Abc { 9 | 10 | private OOP10_Abc() { 11 | 12 | } 13 | 14 | public static void m1() { 15 | 16 | } 17 | 18 | public static void m2() { 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/reviews/review11/car_examples/Toyota.java: -------------------------------------------------------------------------------- 1 | package reviews.review11.car_examples; 2 | 3 | public class Toyota extends Car { 4 | 5 | public Toyota(String model, String color, int year) { 6 | super(model, color, year); 7 | super.make = "Toyota"; 8 | } 9 | 10 | @Override 11 | public void start() { 12 | 13 | System.out.println("Twist the key to ignite"); 14 | 15 | } 16 | 17 | 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/reviews/review13/customExceptions/BreakTimeException.java: -------------------------------------------------------------------------------- 1 | package reviews.review13.customExceptions; 2 | 3 | public class BreakTimeException extends RuntimeException{ 4 | // I am inheriting all the methods of RunTimeException 5 | 6 | public BreakTimeException() { 7 | 8 | } 9 | 10 | public BreakTimeException(String message) { 11 | super(message); // call super class constructor 12 | } 13 | 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/exercises/shorts/_25_staticBlockTest.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts; 2 | 3 | public class _25_staticBlockTest { 4 | 5 | public static void main(String[] args) { 6 | System.out.println("_25_staticBlock.a = " + _25_staticBlock.a); 7 | System.out.println("_25_staticBlock.str = " + _25_staticBlock.str); 8 | System.out.println("_25_staticBlock.ch = " + _25_staticBlock.ch); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/oop/JOOP38_InheritanceContinue/OOP10_Employee.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP38_InheritanceContinue; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP10_Employee { 9 | 10 | // Creating a method 11 | void calculatePay(int hours, double rate) { 12 | System.out.println("Employee total pay : " + (hours * rate)); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/reviews/review12/polymorphism_demo/Superman.java: -------------------------------------------------------------------------------- 1 | package reviews.review12.polymorphism_demo; 2 | 3 | public class Superman extends Father implements Worker{ 4 | 5 | @Override 6 | public void work(String job) { 7 | System.out.println("Superman is working as "+ job); 8 | 9 | } 10 | 11 | @Override 12 | public double getPaid() { 13 | System.out.println("getting paid"); 14 | return 8000; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/core/reviews/week_04/_12_local_Vs_Instance_Variables.java: -------------------------------------------------------------------------------- 1 | package core.reviews.week_04; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class _12_local_Vs_Instance_Variables { 9 | int a; // instance variable 10 | 11 | public void showDifference() { 12 | int a = 5; // local variable 13 | System.out.println(a); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/reviews/review12/polymorphism_demo/Father.java: -------------------------------------------------------------------------------- 1 | package reviews.review12.polymorphism_demo; 2 | 3 | public class Father { 4 | 5 | public void raiseKid() { 6 | System.out.println("Father is raising his kids"); 7 | } 8 | 9 | public void feedKid() { 10 | System.out.println("Father is feeding his Kid"); 11 | } 12 | 13 | public void playWithKid() { 14 | System.out.println("Father is playing with his Kid"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_print_and_println/Question_04.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_print_and_println; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_04 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | System.out.println("Q"); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/exercises/shorts/_42_OOP_Polymorphism_Test/Cube.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._42_OOP_Polymorphism_Test; 2 | 3 | public class Cube extends Shape implements VolumeInterface { 4 | // Came from Shape Abstract Class 5 | @Override 6 | public double area() { 7 | return 0; 8 | } 9 | 10 | // Came from Volume Interface Class 11 | @Override 12 | public double volume() { 13 | return 0; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/exercises/shorts/_40_Abstraction_INTERFACE_Test/Cube.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._40_Abstraction_INTERFACE_Test; 2 | 3 | public class Cube extends Shape implements VolumeInterface{ 4 | // Came from Shape Abstract Class 5 | @Override 6 | public double area() { 7 | return 0; 8 | } 9 | 10 | // Came from Volume Interface Class 11 | @Override 12 | public double volume() { 13 | return 0; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/exercises/shorts/_42_OOP_Polymorphism_Test/Cylinder.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._42_OOP_Polymorphism_Test; 2 | 3 | public class Cylinder extends Shape implements VolumeInterface { 4 | // Came from Shape Abstract Class 5 | @Override 6 | public double area() { 7 | return 0; 8 | } 9 | 10 | // Came from Volume Interface Class 11 | @Override 12 | public double volume() { 13 | return 0; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/oop/JOOP43_Polymorphism/Ipad.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP43_Polymorphism; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class Ipad extends AppleDevice { 8 | @Override 9 | public void use(){ 10 | System.out.println("Ipad | Readbook"); 11 | } 12 | 13 | public void draw(){ 14 | System.out.println("Ipad drawing"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/reviews/review02/EvenorOdd.java: -------------------------------------------------------------------------------- 1 | package reviews.review02; 2 | 3 | /** 4 | * @author esalkan 5 | * @project java-notes 6 | */ 7 | public class EvenorOdd { 8 | public static void main(String[] args) { 9 | int number = 100;// check if this is even or not 10 | if (number % 2 == 0) { 11 | System.out.println("Even"); 12 | } else { 13 | System.out.println("Odd"); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/reviews/review10/SupportPersonel.java: -------------------------------------------------------------------------------- 1 | package reviews.review10; 2 | 3 | public class SupportPersonel extends Employee{ 4 | 5 | public SupportPersonel(String name, String jobTitle, char gender, int age, double salary) { 6 | 7 | super(name, jobTitle, gender, age, salary); 8 | 9 | } 10 | 11 | @Override 12 | public void work() { 13 | System.out.println(getName()+ " is supporting everbody with their HARD work"); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_print_and_println/Question_02.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_print_and_println; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_02 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | System.out.println("Alan, Turing "); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/oop/JOOP36_StaticClassMembers/OOP05_Dinner.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP36_StaticClassMembers; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP05_Dinner { 9 | 10 | static int pizzaSlice = 8; 11 | 12 | public void takeASlice() { 13 | pizzaSlice--; 14 | } 15 | 16 | public void takeASlice(int count) { 17 | pizzaSlice -= count; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/oop/JOOP40_AccessModifiers_FinalKeyword_MethodHiding/Rodent.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP40_AccessModifiers_FinalKeyword_MethodHiding; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Rodent { 9 | 10 | protected int tailLength = 4; 11 | 12 | public void getRodentDetails() { 13 | System.out.println("parentTail : " + tailLength); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/exercises/shorts/_40_Abstraction_INTERFACE_Test/Cylinder.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._40_Abstraction_INTERFACE_Test; 2 | 3 | public class Cylinder extends Shape implements VolumeInterface{ 4 | // Came from Shape Abstract Class 5 | @Override 6 | public double area() { 7 | return 0; 8 | } 9 | 10 | // Came from Volume Interface Class 11 | @Override 12 | public double volume() { 13 | return 0; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/reviews/review04/SalaryTest.java: -------------------------------------------------------------------------------- 1 | package reviews.review04; 2 | 3 | public class SalaryTest { 4 | 5 | public static void main(String[] args) { 6 | 7 | 8 | Salary shevki = new Salary(); 9 | shevki.setInfo(70, 45, 0.19); 10 | 11 | System.out.println(shevki.salaryAfterTax()); 12 | 13 | Salary hande = new Salary(); 14 | hande.setInfo(100, 35, 0.15); 15 | System.out.println(hande.salaryAfterTax()); 16 | 17 | 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/oop/JOOP43_Polymorphism/Mac.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP43_Polymorphism; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class Mac extends AppleDevice { 8 | 9 | @Override 10 | public void use() { 11 | System.out.println("Mac | Code | Play"); 12 | } 13 | 14 | public void code() { 15 | System.out.println("Mac is coding..."); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/core/reviews/week_04/_18_importExample.java: -------------------------------------------------------------------------------- 1 | package core.reviews.week_04; 2 | 3 | import core.reviews.week_03.customMethod; 4 | 5 | /** 6 | * @project Java Core & OOP Notes 7 | * @author esalkan 8 | * @github https://github.com/esalkan/java-notes 9 | */ 10 | public class _18_importExample { 11 | 12 | /** 13 | * @param args 14 | */ 15 | public static void main(String[] args) { 16 | System.out.println(customMethod.getAgeInDays(35)); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/exercises/shorts/_29_superKeywordTest/Dog.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._29_superKeywordTest; 2 | 3 | public class Dog extends Animal { 4 | 5 | // Special feature for DOG just dog can bark 6 | public void bark(){ 7 | System.out.println(name + " is barking"); 8 | } 9 | 10 | public Dog(String name, String breed, char gender, int age, String size, String color) { 11 | super(name, breed, gender, age, size, color); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/core/JC09_controlFlowStatements_Part_3/JC00_Assngmnt.java: -------------------------------------------------------------------------------- 1 | package core.JC09_controlFlowStatements_Part_3; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC00_Assngmnt { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | boolean x = true; 14 | boolean y = !x == false; 15 | 16 | System.out.println(y); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/core/reviews/week_01/_01_notes.java: -------------------------------------------------------------------------------- 1 | package core.reviews.week_01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class _01_notes { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // TODO Auto-generated method stub 15 | /* 16 | * 09/12/2021 17 | * 18 | * 19 | * 20 | * 21 | */ 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/exercises/shorts/_23_constructorsThisKeywordTest/EmployeeObject.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._23_constructorsThisKeywordTest; 2 | 3 | public class EmployeeObject { 4 | public static void main(String[] args) { 5 | Employee emp1 = new Employee("John",'M', "SDET",75000); 6 | Employee emp2 = new Employee("Jane",'F', "SDET",75000); 7 | 8 | System.out.println("emp1 = " + emp1); 9 | System.out.println("emp2 = " + emp2); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/exercises/shorts/_33_methodOverridingTest/Square.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._33_methodOverridingTest; 2 | 3 | public class Square extends Shape { 4 | 5 | public double side; 6 | 7 | public Square(double side) { 8 | this.side = side; 9 | } 10 | 11 | @Override 12 | public double area() { 13 | return side * side; 14 | } 15 | 16 | @Override 17 | public double perimeter() { 18 | return side * 4; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/core/reviews/week_04/_14_bankAccount.java: -------------------------------------------------------------------------------- 1 | package core.reviews.week_04; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class _14_bankAccount { 8 | String accountHolderName; 9 | int pin; 10 | double balance; 11 | long accountNumber; 12 | 13 | public double getBalance(int inputPin) { 14 | if (pin == inputPin) { 15 | return balance; 16 | } 17 | return -1; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/oop/JOOP43_Polymorphism/AppleWatch.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP43_Polymorphism; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class AppleWatch extends AppleDevice { 8 | 9 | @Override 10 | public void use(){ 11 | System.out.println("Apple Watch | Sport"); 12 | } 13 | 14 | public void wear(){ 15 | System.out.println("Wearing apple watch"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/reviews/review01/TellMeAboutYourself.java: -------------------------------------------------------------------------------- 1 | package reviews.review01; 2 | 3 | /** 4 | * @author esalkan 5 | * @project java-notes 6 | */ 7 | public class TellMeAboutYourself { 8 | public static void main(String[] args) { 9 | System.out.print("My name is Oscar\n "); 10 | System.out.println("\t I live in Turkiye"); 11 | System.out.println("I \"teach JAVA\""); 12 | System.out.println("My dream job is to become a SDET"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_print_and_println/Question_01.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_print_and_println; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_01 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | System.out.println("I am ready to be a Java Pro :)"); 16 | 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/exercises/shorts/_38_abstractionTest/Square.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._38_abstractionTest; 2 | 3 | public class Square extends Shape { 4 | 5 | // Square Class instances 6 | public double side; 7 | 8 | // Shape class is super/parent ABSTRACT class 9 | // Square class is here CONSTRUCTOR class 10 | 11 | // Need to OVERRIDE Super/Parent ABSTRACT Class Method 12 | @Override 13 | public double area() { 14 | return side * side; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/oop/JOOP33_Class_Objects_Constructors/OOP09_MouseTest.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP33_Class_Objects_Constructors; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP09_MouseTest { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | OOP10_MouseClass mouse = new OOP10_MouseClass(15); 16 | 17 | mouse.print(); 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/reviews/review09/StaticTest.java: -------------------------------------------------------------------------------- 1 | package reviews.review09; 2 | 3 | public class StaticTest { 4 | 5 | public static void main(String[] args) { 6 | 7 | StaticMethods.displayMessage("Hello EVerybody"); 8 | 9 | StaticMethods obj = new StaticMethods(); 10 | 11 | obj.displayMessage("ANother way of calling static methods"); 12 | 13 | // StaticMethods.instanceMethod; need to call with the object 14 | 15 | obj.instanceMethod(); 16 | 17 | 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/reviews/review10/Tester.java: -------------------------------------------------------------------------------- 1 | package reviews.review10; 2 | 3 | public class Tester extends Employee { 4 | 5 | public Tester(String name, String jobTitle, char gender, int age, double salary) { 6 | super(name, jobTitle, gender, age, salary); 7 | } 8 | 9 | @Override 10 | public void work() { 11 | System.out.println(getName() + " is testing"); 12 | } 13 | 14 | public void findBugs() { 15 | System.out.println(getName()+" found a bug"); 16 | } 17 | 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/reviews/review04/GarbageExample.java: -------------------------------------------------------------------------------- 1 | package reviews.review04; 2 | 3 | public class GarbageExample { 4 | 5 | public static void main(String[] args) { 6 | 7 | String str = "JAVA"; 8 | 9 | str = "python"; // "JAVA" object is unreferenced and eligible for garbage collection 10 | 11 | System.out.println(str); 12 | 13 | 14 | str = null; // "python" is unreferenced and eligible for garbage collection 15 | System.out.println(str); 16 | 17 | 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/exercises/shorts/_42_OOP_Polymorphism_Test/Square.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._42_OOP_Polymorphism_Test; 2 | 3 | public class Square extends Shape { 4 | 5 | // Square Class instances 6 | public double side; 7 | 8 | // Shape class is super/parent ABSTRACT class 9 | // Square class is here CONSTRUCTOR class 10 | 11 | // Need to OVERRIDE Super/Parent ABSTRACT Class Method 12 | @Override 13 | public double area() { 14 | return side * side; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/oop/JOOP38_InheritanceContinue/OOP19_StudentTest.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP38_InheritanceContinue; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP19_StudentTest { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | OOP18_Student st = new OOP18_Student(); 16 | 17 | st.display(); 18 | 19 | st.message(); 20 | 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/reviews/review08/testEnvironment/OS.java: -------------------------------------------------------------------------------- 1 | package reviews.review08.testEnvironment; 2 | 3 | public class OS { 4 | 5 | private String os; 6 | 7 | public OS() { 8 | 9 | } 10 | 11 | public OS(String os) { 12 | this.os = os; 13 | } 14 | 15 | 16 | public String toString() { 17 | return "OS [os=" + os + "]"; 18 | } 19 | 20 | public String getOs() { 21 | return os; 22 | } 23 | 24 | public void setOs(String os) { 25 | this.os = os; 26 | } 27 | 28 | 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/exercises/interview_exercises/number_tasks/Number_Fibonacci.java: -------------------------------------------------------------------------------- 1 | package exercises.interview_exercises.number_tasks; 2 | 3 | public class Number_Fibonacci { 4 | 5 | public static int fibonacci(int num) { 6 | 7 | int result = 0; 8 | int j = 0; 9 | int z = 1; 10 | 11 | for (int i = 1; i < num; i++) { 12 | result = j + z; 13 | j = z; 14 | z = result; 15 | } 16 | 17 | return result; 18 | } 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_test01/Question_03.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_test01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_03 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // What will be the output of this code? 16 | 17 | System.out.println(3 * (4 + 4 * 4) / 2 - 6); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_test01/Question_26.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_test01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_26 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // When we declare if statement, it is mandatory to give the else block 16 | 17 | // Answer = No 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/oop/JOOP36_StaticClassMembers/OOP03_Countable.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP36_StaticClassMembers; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP03_Countable { 9 | 10 | static int instanceCount; // Instance Variable 11 | int instanceCount2; 12 | 13 | public OOP03_Countable() { 14 | instanceCount++; 15 | } 16 | 17 | public int getInstanceCount() { 18 | return instanceCount; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/reviews/review03/TernaryExample.java: -------------------------------------------------------------------------------- 1 | package reviews.review03; 2 | 3 | public class TernaryExample { 4 | 5 | public static void main(String[] args) { 6 | 7 | int num1 = 100; 8 | int num2 = 10000; 9 | int biggerNumber; 10 | 11 | // if(num1>num2) { 12 | // biggerNumber=num1; 13 | // 14 | // }else { 15 | // biggerNumber=num2; 16 | // } 17 | 18 | biggerNumber = (num1>num2)? num1 : num2; 19 | 20 | System.out.println(biggerNumber); 21 | 22 | 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/reviews/review04/AmazonTest_2.java: -------------------------------------------------------------------------------- 1 | package reviews.review04; 2 | 3 | public class AmazonTest_2 { 4 | 5 | public static void main(String[] args) { 6 | 7 | System.out.println("--Starting Amazon Search Functional Test--"); 8 | AmazonTest.openBrowser(); 9 | AmazonTest.navigateToAmazonPage(); 10 | AmazonTest.searchForAnItem("Selenium"); 11 | AmazonTest.verifyResultsAreDisplayed(); 12 | System.out.println("Amazon Search Functional Test compeleted-PASS-"); 13 | 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/reviews/review09/inheritance/Ebook.java: -------------------------------------------------------------------------------- 1 | package reviews.review09.inheritance; 2 | 3 | public class Ebook extends Book { 4 | 5 | int size; // MB 6 | int pages; 7 | String format; // mobi, epub 8 | 9 | public void readBook() { 10 | System.out.println("Reading book: "); 11 | System.out.println("Title : "+title); 12 | System.out.println("Author : "+ author); 13 | System.out.println("Size : "+size); 14 | System.out.println("Pages : "+pages); 15 | 16 | 17 | } 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/exercises/shorts/_40_Abstraction_INTERFACE_Test/Square.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._40_Abstraction_INTERFACE_Test; 2 | 3 | public class Square extends Shape { 4 | 5 | // Square Class instances 6 | public double side; 7 | 8 | // Shape class is super/parent ABSTRACT class 9 | // Square class is here CONSTRUCTOR class 10 | 11 | // Need to OVERRIDE Super/Parent ABSTRACT Class Method 12 | @Override 13 | public double area() { 14 | return side * side; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/exercises/shorts/_38_abstractionTest/Rectangle.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._38_abstractionTest; 2 | 3 | public class Rectangle extends Shape{ 4 | // Rectangle Class instances 5 | public double width, length; 6 | 7 | // Shape class is super/parent ABSTRACT class 8 | // Rectangle class is here CONSTRUCTOR class 9 | 10 | // Need to OVERRIDE Super/Parent ABSTRACT Class Methods 11 | @Override 12 | public double area() { 13 | return width * length; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/exercises/shorts/_38_abstractionTest/Circle.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._38_abstractionTest; 2 | 3 | public class Circle extends Shape { 4 | 5 | // Circle Class instances 6 | double radius; 7 | double PI = 3.14; 8 | 9 | // Shape class is super/parent ABSTRACT class 10 | // Circle class is here CONSTRUCTOR class 11 | 12 | // Need to OVERRIDE Super/Parent ABSTRACT Class Methods 13 | @Override 14 | public double area() { 15 | return radius * radius * PI; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/oop/JOOP40_AccessModifiers_FinalKeyword_MethodHiding/Marsupial.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP40_AccessModifiers_FinalKeyword_MethodHiding; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Marsupial { 9 | 10 | public static boolean isBiped() { 11 | return false; 12 | } 13 | 14 | public void getMarsupialDescription() { 15 | System.out.println("Marsupial walks on the two legs : " + isBiped()); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/reviews/review10/Developer.java: -------------------------------------------------------------------------------- 1 | package reviews.review10; 2 | 3 | public class Developer extends Employee { 4 | 5 | public Developer(String name, String jobTitle, char gender, int age, double salary) { 6 | super(name, jobTitle, gender, age, salary); 7 | 8 | } 9 | 10 | @Override 11 | public void work() { 12 | System.out.println(getName()+ " is coding"); 13 | } 14 | 15 | public void fixBugs() { 16 | System.out.println(getName()+" is fixing the bug like men"); 17 | } 18 | 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/core/JC05_unaryAssignmentRelationalLogicalOperators/JC05_task_21_unaryOperators.java: -------------------------------------------------------------------------------- 1 | package core.JC05_unaryAssignmentRelationalLogicalOperators; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC05_task_21_unaryOperators { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | 14 | int x = 4; 15 | int y = x * 4 - x++; 16 | System.out.println(y); 17 | 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/exercises/shorts/_42_OOP_Polymorphism_Test/Rectangle.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._42_OOP_Polymorphism_Test; 2 | 3 | public class Rectangle extends Shape { 4 | // Rectangle Class instances 5 | public double width, length; 6 | 7 | // Shape class is super/parent ABSTRACT class 8 | // Rectangle class is here CONSTRUCTOR class 9 | 10 | // Need to OVERRIDE Super/Parent ABSTRACT Class Methods 11 | @Override 12 | public double area() { 13 | return width * length; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/reviews/review06/QuizQ4.java: -------------------------------------------------------------------------------- 1 | package reviews.review06; 2 | 3 | public class QuizQ4 { 4 | 5 | public static void main(String[] args) { 6 | int wd = 0; //-1, 0, 2, 4, 3 7 | String [] days = {"sun","mon","wed","sat"}; 8 | 9 | for(int i=0; i= 0 ; i--, j++){ 15 | result[j] = arr[i]; 16 | } 17 | 18 | return result; 19 | } 20 | 21 | 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/oop/JOOP38_InheritanceContinue/OOP12_Contractor.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP38_InheritanceContinue; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP12_Contractor extends OOP10_Employee { 9 | 10 | // Override the method from Parent Class _10_Employee 11 | @Override 12 | void calculatePay(int hours, double rate) { 13 | double total = (hours * rate) + 200; 14 | System.out.println("Contractor Total Pay : " + total); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/reviews/review03/BasicLoopExamples.java: -------------------------------------------------------------------------------- 1 | package reviews.review03; 2 | 3 | public class BasicLoopExamples { 4 | 5 | public static void main(String[] args) { 6 | 7 | for(int i=0 ; i<10 ; i+=1 ) { 8 | System.out.print("Hello "); 9 | } 10 | 11 | // System.out.println(i); just local to the for loop 12 | System.out.println(""); 13 | System.out.println("--------------------------------------"); 14 | 15 | for(int i=1; i<=10 ; i++) { 16 | 17 | System.out.println("2 X "+i+" = "+(2*i)); 18 | } 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/reviews/review05/S04_IndexOfExample.java: -------------------------------------------------------------------------------- 1 | package reviews.review05; 2 | 3 | public class S04_IndexOfExample { 4 | 5 | public static void main(String[] args) { 6 | 7 | String message = "Java is Awesome! Akgkf !! AA kgfkdls!"; 8 | 9 | // this method takes a String and returns it's index 10 | 11 | int begining = message.indexOf("Awe"); 12 | int ending = message.indexOf("me!")+2; 13 | 14 | String word = message.substring(begining,ending); 15 | 16 | System.out.println(word); 17 | 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/reviews/review11/exercise_example/FreeWeight.java: -------------------------------------------------------------------------------- 1 | package reviews.review11.exercise_example; 2 | 3 | public class FreeWeight extends Lifting{ 4 | 5 | @Override 6 | public void endLift() { 7 | 8 | System.out.println("Carefully placing the weights"); 9 | 10 | } 11 | 12 | @Override 13 | public void perform() { 14 | 15 | System.out.println("Lifting Free Weight dumbbells"); 16 | 17 | } 18 | 19 | @Override 20 | public int getCaloriesCount(int minutes) { 21 | 22 | 23 | return minutes*6; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/reviews/review13/StringIndexProblem.java: -------------------------------------------------------------------------------- 1 | package reviews.review13; 2 | 3 | public class StringIndexProblem { 4 | 5 | public static void main(String[] args) { 6 | 7 | String word = "java"; 8 | 9 | try { 10 | System.out.println(word.charAt(10)); 11 | }catch(Exception e) { 12 | System.out.println(e.getMessage()); 13 | System.out.println("Type of eception: " + e.getClass().getSimpleName()); 14 | 15 | } 16 | 17 | System.out.println(word.toUpperCase()); 18 | 19 | 20 | 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/core/JC12_branchingStatements/JC01_breakContinue.java: -------------------------------------------------------------------------------- 1 | package core.JC12_branchingStatements; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC01_breakContinue { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | for (int i = 1; i <= 5; i++) { 14 | 15 | if (i == 4) { 16 | 17 | break; 18 | // continue; 19 | 20 | } 21 | 22 | System.out.println(i); 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/core/reviews/week_07/Products.java: -------------------------------------------------------------------------------- 1 | package core.reviews.week_07; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Products { 9 | 10 | /** 11 | * @param args 12 | */ 13 | 14 | String name; 15 | double price; 16 | 17 | public void setInfo(String n, double d) { 18 | name = n; 19 | price = d; 20 | } 21 | 22 | public String toString() { 23 | return "Products [name=" + name + ", price=" + price + "]"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/exercises/shorts/_40_Abstraction_INTERFACE_Test/Circle.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._40_Abstraction_INTERFACE_Test; 2 | 3 | public class Circle extends Shape { 4 | 5 | // Circle Class instances 6 | double radius; 7 | double PI = 3.14; 8 | 9 | // Shape class is super/parent ABSTRACT class 10 | // Circle class is here CONSTRUCTOR class 11 | 12 | // Need to OVERRIDE Super/Parent ABSTRACT Class Methods 13 | @Override 14 | public double area() { 15 | return radius * radius * PI; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/oop/JOOP38_InheritanceContinue/OOP16_CarTest.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP38_InheritanceContinue; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP16_CarTest { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Creating a c1 object from _15_Car Class 16 | OOP15_Car c1 = new OOP15_Car(); 17 | 18 | // Call the _15_Car class display() Method 19 | c1.display(); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/exercises/shorts/_33_methodOverridingTest/Circle.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._33_methodOverridingTest; 2 | 3 | public class Circle extends Shape { 4 | 5 | public double radius; 6 | public static double pi = 3.14; 7 | 8 | public Circle(double radius) { 9 | this.radius = radius; 10 | } 11 | 12 | @Override 13 | public double area() { 14 | return radius * radius * pi; 15 | } 16 | 17 | @Override 18 | public double perimeter() { 19 | return 2 * radius * pi; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/oop/JOOP34_Constructors_PassingObjectsToMethods/OOP02_LightTest.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP34_Constructors_PassingObjectsToMethods; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP02_LightTest { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | OOP01_Light l1 = new OOP01_Light(); 16 | 17 | // JVM see new keyword - invoke constructor 18 | // Which constructor 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/reviews/review11/car_examples/ParkingLot.java: -------------------------------------------------------------------------------- 1 | package reviews.review11.car_examples; 2 | 3 | public class ParkingLot { 4 | 5 | public static void main(String[] args) { 6 | 7 | // Car car = new Car(); can not instantiate from abstract class 8 | 9 | Toyota camry = new Toyota("Camry", "White", 2019); 10 | 11 | camry.start(); 12 | System.out.println(camry.toString()); 13 | 14 | BMW M5 = new BMW("M5", "BMW", "Black", 2021); 15 | 16 | M5.start(); 17 | System.out.println(M5); 18 | 19 | 20 | 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/reviews/review13/customExceptions/CustomExceptionTest.java: -------------------------------------------------------------------------------- 1 | package reviews.review13.customExceptions; 2 | 3 | public class CustomExceptionTest { 4 | 5 | public static void main(String[] args) { 6 | 7 | int minutes = 50; 8 | 9 | System.out.println("Class is going on for "+ minutes+" minutes"); 10 | 11 | if(minutes > 45) { 12 | throw new BreakTimeException("It is break time Hocam"); 13 | } 14 | 15 | System.out.println("Let's continue the class another "+(45-minutes) 16 | +" minutes"); 17 | 18 | 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/core/JC13_methods_Part_1/JC08_task_56_convertKM.java: -------------------------------------------------------------------------------- 1 | package core.JC13_methods_Part_1; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC08_task_56_convertKM { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | convertKM(); 14 | } 15 | public static void convertKM() { 16 | int mile = 80; 17 | double km = mile * 1.60934; 18 | System.out.println(mile + " mile = " + km + " km"); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/exercises/interview_exercises/number_tasks/Number_ReverseInteger.java: -------------------------------------------------------------------------------- 1 | package exercises.interview_exercises.number_tasks; 2 | 3 | public class Number_ReverseInteger { 4 | 5 | 6 | 7 | public static int reverse(int number){ 8 | if(number < 10 && number >= 0){ 9 | return number; 10 | } 11 | 12 | int result = 0; 13 | while (number !=0) { 14 | result = result * 10 + number % 10; 15 | number /= 10; 16 | } 17 | 18 | return result; 19 | } 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/oop/JOOP45_ExceptionsAndErrorHandling/Ex01_BadArray.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP45_ExceptionsAndErrorHandling; 2 | 3 | /** 4 | * @author esalkan 5 | * @project java-notes 6 | */ 7 | public class Ex01_BadArray { 8 | /** 9 | * @param args 10 | */ 11 | public static void main(String[] args) { 12 | int[] number = {1,2,3,4,5}; 13 | 14 | for (int i = 0; i <= number.length; i++) { 15 | System.out.println(number[i]); 16 | } 17 | System.out.println("Exceptions and Error Handling"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/exercises/interview_exercises/string_tasks/String_Reverse.java: -------------------------------------------------------------------------------- 1 | package exercises.interview_exercises.string_tasks; 2 | 3 | public class String_Reverse { 4 | 5 | /* 6 | Write a function that can reverse String 7 | Ex: Reverse("ABCD"); ==> DCBA 8 | */ 9 | 10 | public static String StrReverse(String str) { 11 | 12 | String reverse=""; 13 | 14 | for(int i=str.length()-1; i >= 0; i--) { 15 | reverse += str.toCharArray()[i]; 16 | } 17 | return reverse; 18 | 19 | } 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/oop/JOOP38_InheritanceContinue/OOP06_DogTest.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP38_InheritanceContinue; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP06_DogTest { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // who is job in java to init variables 16 | OOP05_Dog d = new OOP05_Dog(2, 4, 1, 20, "Long Silky"); 17 | 18 | // print name 19 | System.out.println(d.getName()); 20 | 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/core/JC14_methods_Part_2/JC07_task_62_calculateGreatest.java: -------------------------------------------------------------------------------- 1 | package core.JC14_methods_Part_2; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC07_task_62_calculateGreatest { 8 | 9 | // Write a method that accepts 3 numbers and displays the greatest one in the 10 | // console. 11 | // Sample Output: calculateGreatest(5,2,3) -- >5 12 | 13 | /** 14 | * @param args 15 | */ 16 | public static void main(String[] args) { 17 | 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/core/JC15_methodOverloading/JC08_methodOverloading_2.java: -------------------------------------------------------------------------------- 1 | package core.JC15_methodOverloading; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC08_methodOverloading_2 { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | 14 | } 15 | 16 | public static int method1(int num1, int num2) { 17 | return 5; 18 | } 19 | 20 | public static double method1(int num1, float num2) { 21 | return 5.2; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/exercises/interview_exercises/array_tasks/Array_FindMinimum.java: -------------------------------------------------------------------------------- 1 | package exercises.interview_exercises.array_tasks; 2 | 3 | public class Array_FindMinimum { 4 | 5 | /* 6 | Write a function that can find the maximum number from an int Array 7 | */ 8 | 9 | public static int maxValue(int[] n) { 10 | 11 | int min = Integer.MAX_VALUE; 12 | 13 | for (int each : n) { 14 | if (each < min) { 15 | min = each; 16 | } 17 | } 18 | 19 | return min; 20 | 21 | } 22 | 23 | 24 | } -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_23.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_23 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Solved & Passed 16 | // What will be the output of this code? 17 | 18 | int k = 2; 19 | do { 20 | System.out.println(k); 21 | } while (k-- > 0); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa05_nestedLoops/Question_6.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa05_nestedLoops; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_6 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Write a Java program to print the following pattern 16 | 17 | // 1 18 | // 2 6 19 | // 3 7 10 20 | // 4 8 11 13 21 | // 5 9 12 14 15 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/replit/basics/FixCode.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.replit.basics; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class FixCode { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // Solved and Test Cases Passed 15 | // Rearrange the following code so that it forms a correct program 16 | // that prints out the letter Q 17 | System.out.println("Q"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/oop/JOOP38_InheritanceContinue/OOP11_FullTimeEmployee.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP38_InheritanceContinue; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP11_FullTimeEmployee extends OOP10_Employee { 9 | 10 | // Override the method from Parent Class _10_Employee 11 | @Override 12 | void calculatePay(int hours, double rate) { 13 | double total = (hours * rate) * 1.05; 14 | System.out.println("FullTime Employee Total Pay : " + total); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/exercises/interview_exercises/array_tasks/Array_FindMaximum.java: -------------------------------------------------------------------------------- 1 | package exercises.interview_exercises.array_tasks; 2 | 3 | public class Array_FindMaximum { 4 | /* 5 | Write a function that can find the maximum number from an int Array 6 | */ 7 | 8 | 9 | public static int maxValue(int[] n) { 10 | 11 | int max = Integer.MIN_VALUE; 12 | 13 | for (int each : n) { 14 | if (each > max) { 15 | max = each; 16 | } 17 | } 18 | 19 | return max; 20 | } 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_test01/Question_10.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_test01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_10 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // What will be the output of this code? 16 | 17 | boolean flag = false; 18 | 19 | if (false) { 20 | flag = !flag; 21 | System.out.println(flag); 22 | } 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/replit/basics/HelloWorld_2.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.replit.basics; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class HelloWorld_2 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // Solved and Test Cases Passed 15 | // Write a complete main method that prints 16 | // Hello world to the screen. 17 | 18 | System.out.println("Hello world"); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/oop/JOOP36_StaticClassMembers/OOP14_StaticImport.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP36_StaticClassMembers; 2 | 3 | import static java.lang.Math.*; 4 | 5 | /** 6 | * @project Java Core & OOP Notes 7 | * @author esalkan 8 | * @github https://github.com/esalkan/java-notes 9 | */ 10 | public class OOP14_StaticImport { 11 | 12 | public static void main(String[] args) { 13 | 14 | System.out.println(Math.PI); 15 | System.out.println(sqrt(16)); // after import math --staticly-- directly you can reach the build-in methods 16 | System.out.println(PI); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/reviews/review03/CustomMethod2.java: -------------------------------------------------------------------------------- 1 | package reviews.review03; 2 | 3 | public class CustomMethod2 { 4 | 5 | public static void main(String[] args) { 6 | 7 | int person1 = 10; 8 | eligibleOrNot(person1); 9 | 10 | eligibleOrNot(20); 11 | 12 | eligibleOrNot(24); 13 | 14 | } 15 | 16 | public static void eligibleOrNot(int age) { 17 | 18 | int person = age; 19 | 20 | if (person>=21) { 21 | System.out.println("Eligible to buy"); 22 | }else { 23 | System.out.println("NOT Eligible to buy"); 24 | } 25 | } 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/core/JC03_variables_dataTypes/JC11_task_11_variablesDataTypes.java: -------------------------------------------------------------------------------- 1 | package core.JC03_variables_dataTypes; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC11_task_11_variablesDataTypes { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | int a, b, c; 14 | a = 10; 15 | b = 20; 16 | c = a; 17 | a = b; 18 | 19 | System.out.println(a); 20 | System.out.println(b); 21 | System.out.println(c); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/core/JC11_controlFlowStatements_Part_5/JC04_task_47_nestedForLoops.java: -------------------------------------------------------------------------------- 1 | package core.JC11_controlFlowStatements_Part_5; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC04_task_47_nestedForLoops { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | for (int i = 0; i <= 6; i++) { 14 | 15 | for (int j = 0; j <= 6; j++) { 16 | System.out.print("*"); 17 | } 18 | System.out.println(); 19 | } 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/core/JC11_controlFlowStatements_Part_5/JC05_task_48_nestedForLoops.java: -------------------------------------------------------------------------------- 1 | package core.JC11_controlFlowStatements_Part_5; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC05_task_48_nestedForLoops { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | 14 | for (int i = 1; i <= 7; i++) { 15 | 16 | for (int j = 1; j <= i; j++) { 17 | System.out.print("*"); 18 | } 19 | System.out.println(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_03.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_03 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Solved & Not Passed 16 | 17 | // What will be the output of this code? 18 | 19 | int i; 20 | for (i = 0; i <= 2; i++) { 21 | System.out.println(i); 22 | } 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_test01/Question_01.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_test01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_01 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // What will be the output of this code? 15 | 16 | int one = 1; 17 | String two = "2"; 18 | 19 | System.out.println(two + 1 + one); 20 | System.out.println(one + 1 + two); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/oop/JOOP40_AccessModifiers_FinalKeyword_MethodHiding/Mouse.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP40_AccessModifiers_FinalKeyword_MethodHiding; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Mouse extends Rodent{ 9 | 10 | protected int tailLength = 8; 11 | 12 | // if we use super.tailLength it will retrive the value from parent class. 13 | public void getMouseDetails() { 14 | System.out.println("tail : " + tailLength + ", parentTail : " + super.tailLength); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/exercises/interview_exercises/number_tasks/Number_Armstrong.java: -------------------------------------------------------------------------------- 1 | package exercises.interview_exercises.number_tasks; 2 | 3 | public class Number_Armstrong { 4 | 5 | /* 6 | Write a method that can check if a number is Armstrong number 7 | */ 8 | 9 | public static boolean isArmStrongNumber(int num) { 10 | int a = 0, b = 0, c = num; 11 | 12 | while (num > 0) { 13 | a = num % 10; 14 | num /= 10; 15 | b = b + (a * a * a); 16 | } 17 | 18 | return (c == b) ? true : false; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_test01/Question_15.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_test01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_15 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // What will be the output of this code? 16 | 17 | int a = 1 + 2 + 3 * 4; 18 | int b = 2 * 3 + 4; 19 | 20 | int total = a + b; 21 | 22 | System.out.println(total); 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_16.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_16 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Solved & Passed 16 | 17 | // What will be the output of this code? 18 | 19 | int i = 3; 20 | 21 | while (i < 6) { 22 | System.out.println(i); 23 | i += 1; 24 | } 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/exercises/shorts/_33_methodOverridingTest/Rectangle.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._33_methodOverridingTest; 2 | 3 | public class Rectangle extends Shape{ 4 | 5 | public double width; 6 | public double length; 7 | 8 | public Rectangle(double width, double length){ 9 | this.width = width; 10 | this.length = length; 11 | } 12 | 13 | @Override 14 | public double area() { 15 | return width * length; 16 | } 17 | 18 | @Override 19 | public double perimeter() { 20 | return 2 * (width * length); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/oop/JOOP41_Abstraction/Practice/Iphone.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP41_Abstraction.Practice; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Iphone extends Phone { 9 | 10 | @Override 11 | public void call() { 12 | // Code 13 | } 14 | 15 | /* 16 | * That implementation will give error because text() Method is not in Phone 17 | * Abstract class. it is in MobilePhone abstract class method. 18 | * 19 | * @Override public void text(){ //code } 20 | * 21 | */ 22 | } 23 | -------------------------------------------------------------------------------- /src/reviews/review01/PrintStatements.java: -------------------------------------------------------------------------------- 1 | package reviews.review01; 2 | 3 | /** 4 | * @author esalkan 5 | * @project java-notes 6 | */ 7 | public class PrintStatements { 8 | public static void main(String[] args) { 9 | 10 | System.out.println("Hello, Welcome to Java"); 11 | 12 | System.out.println("Hi"); 13 | 14 | System.out.println("------------------------------------"); 15 | 16 | System.out.print("Hello, Welcome to Java"); 17 | 18 | System.out.println("Hi"); // print Hi to console than go to next line 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_10.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_10 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Solved & Passed 16 | 17 | // What will be the output of this code? 18 | 19 | int x = 5; 20 | 21 | while (x < 10) { 22 | System.out.println(x); 23 | x++; 24 | } 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/exercises/shorts/_29_superKeywordTest/Cat.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._29_superKeywordTest; 2 | 3 | public class Cat extends Animal { 4 | 5 | // Special just for CAT 6 | public void meow(){ 7 | System.out.println(name + " is meow now"); 8 | } 9 | 10 | // Special just for CAT 11 | public void scratch(){ 12 | System.out.println(name + " is scratch"); 13 | } 14 | 15 | 16 | public Cat(String name, String breed, char gender, int age, String size, String color) { 17 | super(name, breed, gender, age, size, color); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/oop/JOOP40_AccessModifiers_FinalKeyword_MethodHiding/Car.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP40_AccessModifiers_FinalKeyword_MethodHiding; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | 9 | public class Car { 10 | String model; // Default : Accessable in same package. 11 | public int year; // Public : Accessable from anywhere. 12 | private int door; // Private : Accessable inside the same class. 13 | protected double engine; // Protected : Acessable to all other classes in the same package. 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/reviews/review03/CustomMethod3.java: -------------------------------------------------------------------------------- 1 | package reviews.review03; 2 | 3 | public class CustomMethod3 { 4 | 5 | public static void main(String[] args) { 6 | 7 | System.out.println(getAgeInDays(10) + " Days old. "); 8 | 9 | System.out.println(getAgeInDaysWithMSG(10)); 10 | } 11 | 12 | 13 | public static int getAgeInDays(int years) { 14 | 15 | // int days = years * 365; 16 | 17 | return years * 365; 18 | } 19 | 20 | 21 | public static String getAgeInDaysWithMSG(int years) { 22 | 23 | return (years * 365) + " Days old."; 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_test01/Question_07.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_test01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_07 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // What will be the output of this code? 16 | 17 | if (true) { 18 | if (false) { 19 | System.out.println("a"); 20 | } else { 21 | System.out.println("b"); 22 | } 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_04.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_04 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Solved & Passed 16 | 17 | // How many times will the following code print "Hello World" ? 18 | 19 | for (int i = 0; i < 10; i++) { 20 | System.out.println("Hello World"); 21 | } 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_12.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_12 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Solved & Passed 16 | 17 | // What will be the output of this code? 18 | 19 | do { 20 | System.out.println("100"); 21 | } while (false); 22 | 23 | System.out.println("Bye"); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/oop/JOOP38_InheritanceContinue/OOP18_Student.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP38_InheritanceContinue; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP18_Student extends OOP17_Person { 9 | 10 | @Override 11 | public void message() { 12 | System.out.println("This is student class"); 13 | } 14 | 15 | void display() { 16 | // This method calling from _18_Student Class 17 | message(); 18 | 19 | // This method calling from _17_Person Parent Class 20 | super.message(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/reviews/review10/AmazonInc.java: -------------------------------------------------------------------------------- 1 | package reviews.review10; 2 | 3 | public class AmazonInc { 4 | 5 | public static void main(String[] args) { 6 | 7 | Tester tester = new Tester("Polad", "SDET", 'M', 35, 100000); 8 | 9 | tester.setJobTitle("Quality Engineer"); 10 | tester.setAge(25); 11 | tester.findBugs(); 12 | 13 | Developer developer = new Developer("Ibrahim", "Front End Developer", 'M', 35, 150000); 14 | 15 | developer.fixBugs(); 16 | developer.setSalary(0); 17 | System.out.println(developer.getSalary()); 18 | 19 | 20 | 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/reviews/review02/RelationalOperators.java: -------------------------------------------------------------------------------- 1 | package reviews.review02; 2 | 3 | /** 4 | * @author esalkan 5 | * @project java-notes 6 | */ 7 | public class RelationalOperators { 8 | public static void main(String[] args) { 9 | System.out.println(100 > 1000); // false 10 | System.out.println('A' == 65); // true 11 | System.out.println(15 >= 15); 12 | System.out.println("---------Question from Discord-------------"); 13 | int b = 2; 14 | boolean res = ++b == 2 || --b == 2 && --b == 2; // 15 | System.out.println(res); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/core/JC11_controlFlowStatements_Part_5/JC07_task_50_nestedForLoops.java: -------------------------------------------------------------------------------- 1 | package core.JC11_controlFlowStatements_Part_5; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC07_task_50_nestedForLoops { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | int rows = 5; 14 | 15 | for (int i = 1; i <= rows; i++) { 16 | for (int j = 1; j <= i; j++) { 17 | System.out.print(j + " "); 18 | } 19 | System.out.println(); 20 | } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/core/JC16_classObjects/JC01_dogClass.java: -------------------------------------------------------------------------------- 1 | package core.JC16_classObjects; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC01_dogClass { 8 | String breed; 9 | int age; 10 | String color; 11 | String name; 12 | 13 | public void barking() { 14 | System.out.println(name + " is barking."); 15 | } 16 | 17 | public void hungry() { 18 | System.out.println(name + " is hungry."); 19 | } 20 | 21 | public void sleeping() { 22 | System.out.println(name + " is sleeping."); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/core/JC25_Arrays_Part_2/JC06_PassElements.java: -------------------------------------------------------------------------------- 1 | package core.JC25_Arrays_Part_2; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class JC06_PassElements { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | int[] numbers = { 541, 0, 1, 2, 3, 4, 5, 1453 }; 16 | 17 | for (int value : numbers) { 18 | showValue(value); 19 | } 20 | 21 | } 22 | 23 | public static void showValue(int n) { 24 | System.out.print(n + " "); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/exercises/interview_exercises/number_tasks/Number_Prime.java: -------------------------------------------------------------------------------- 1 | package exercises.interview_exercises.number_tasks; 2 | 3 | public class Number_Prime { 4 | 5 | /* 6 | Write a method that can check if a number is prime or not 7 | */ 8 | 9 | public static boolean primeNumber(int num) { 10 | if (num < 2) { 11 | return false; 12 | } 13 | 14 | for (int i = 2; i < num; i++) { 15 | if (num % i == 0) { 16 | return false; 17 | } 18 | } 19 | 20 | return true; 21 | 22 | } 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_20.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_20 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Solved & Passed 16 | 17 | // What will be the output of this code? 18 | 19 | int i1 = 1, i2 = 2, i3 = 4; 20 | i2 = i3 % 3; 21 | int i4 = i1 + (i2 * i3) + i3; 22 | System.out.println(i4); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa04_loops/Question_01.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa04_loops; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_01 { 9 | 10 | // Write a for loop that displays the following set of numbers: 11 | // 0,10,20,30,40,50,...1000 12 | /** 13 | * @param args 14 | */ 15 | public static void main(String[] args) { 16 | 17 | // Solved 18 | 19 | for (int i = 0; i <= 1000; i += 10) { 20 | System.out.println(i); 21 | } 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/replit/basics/HelloWorld_1.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.replit.basics; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class HelloWorld_1 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // Solved and Test Cases Passed 15 | // Write a statement that prints Hello world to the screen. 16 | // Output must exactly match the requirement 17 | 18 | System.out.println("Hello world"); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/core/JC11_controlFlowStatements_Part_5/JC06_task_49_nestedForLoops.java: -------------------------------------------------------------------------------- 1 | package core.JC11_controlFlowStatements_Part_5; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC06_task_49_nestedForLoops { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | int rows = 7; 14 | 15 | for (int i = 1; i <= rows; i++) { 16 | 17 | for (int j = 1; j <= i; j++) { 18 | System.out.print(" "); 19 | } 20 | System.out.println("#"); 21 | } 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/core/JC13_methods_Part_1/JC09_task_57_sumOfNumbers.java: -------------------------------------------------------------------------------- 1 | package core.JC13_methods_Part_1; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC09_task_57_sumOfNumbers { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | sumNumbers(); 14 | } 15 | 16 | 17 | public static void sumNumbers() { 18 | int num1 = 10; 19 | int num2 = 50; 20 | int num3 = 50; 21 | int sum = num1 + num2 + num3; 22 | System.out.println("Total is " + sum); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/core/JC14_methods_Part_2/JC08_task_63_fahrenheitToCelciusConverter.java: -------------------------------------------------------------------------------- 1 | package core.JC14_methods_Part_2; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC08_task_63_fahrenheitToCelciusConverter { 8 | 9 | // Write a function that accepts Fahrenheit and displays the Celcius in the 10 | // console. 11 | // Sample Output: calculateCelcius(32) -- > 0 calculateCelcius(50) --> 10 12 | 13 | /** 14 | * @param args 15 | */ 16 | public static void main(String[] args) { 17 | 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/oop/JOOP38_InheritanceContinue/OOP08_StaticSub.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP38_InheritanceContinue; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | 9 | // _08_StaticSub is in a relationship with _07_StaticSuper 10 | public class OOP08_StaticSub extends OOP07_StaticSuper { 11 | 12 | // Creating a method 13 | public void print() { 14 | // _07_StaticSuper is parent and _08_StaticSub is extended from it. thats whw we 15 | // can use in here it static instance variables. 16 | System.out.println(num); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/oop/JOOP39_Inheritance_AccessModifiers/OOP04_ToyotaTest.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP39_Inheritance_AccessModifiers; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP04_ToyotaTest { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | OOP03_Toyota toyota = new OOP03_Toyota(36); 16 | 17 | toyota.steer(40); 18 | System.out.println(); 19 | toyota.accelerate(30); 20 | System.out.println(); 21 | toyota.accelerate(20); 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/core/JC14_methods_Part_2/JC09_task_64_starPatterns.java: -------------------------------------------------------------------------------- 1 | package core.JC14_methods_Part_2; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC09_task_64_starPatterns { 8 | 9 | // Write a program that accepts a number and print the star patterns according 10 | // to that number 11 | // Sample Output: printPattern(5); 12 | // * 13 | // ** 14 | // *** 15 | // **** 16 | // ***** 17 | 18 | /** 19 | * @param args 20 | */ 21 | public static void main(String[] args) { 22 | 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/core/reviews/week_02/evenorOdd.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package core.reviews.week_02; 5 | 6 | /** 7 | * @project Java Core & OOP Notes 8 | * @author esalkan 9 | * @github https://github.com/esalkan/java-notes 10 | */ 11 | public class evenorOdd { 12 | 13 | /** 14 | * @param args 15 | */ 16 | public static void main(String[] args) { 17 | // TODO Auto-generated method stub 18 | 19 | int number = 100;// check if this is even or not 20 | 21 | if (number % 2 == 0) { 22 | System.out.println("Even"); 23 | } else { 24 | System.out.println("Odd"); 25 | } 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_25.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_25 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Solved & Passed 16 | 17 | // What will be the output of this code? 18 | 19 | boolean b = false; 20 | int i = 1; 21 | do { 22 | i++; 23 | } while (b = !b); 24 | 25 | System.out.println(i); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa04_loops/Question_05.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa04_loops; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_05 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Solved 16 | 17 | // Print the table of 12 using for loop. 18 | 19 | int num = 12; 20 | 21 | for (int i = 1; i <= 10; i++) { 22 | System.out.println(num + " X " + i + " = " + i * num); 23 | } 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/replit/basics/Cool.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.replit.basics; 2 | 3 | import java.util.Scanner; 4 | 5 | /** 6 | * @project Java Core & OOP Notes 7 | * @author esalkan 8 | * @github https://github.com/esalkan/java-notes 9 | */ 10 | public class Cool { 11 | 12 | /** 13 | * @param args 14 | */ 15 | public static void main(String[] args) { 16 | // Solved and Test Cases Passed 17 | // Write a program that displays: 18 | // I think being a programmer is cool 19 | 20 | System.out.println("I think beign a programmer is cool"); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/oop/JOOP37_Inheritance/OOP03_Employee.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP37_Inheritance; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP03_Employee extends OOP01_Person { 9 | 10 | String jobTitle; 11 | 12 | public void work() { 13 | 14 | System.out.println(name + " is working as " + jobTitle); 15 | 16 | } 17 | 18 | @Override 19 | public String toString() { 20 | 21 | return "Employee [jobTitle=" + jobTitle + " , name=" + name + ", age=" + age + ", gender=" + gender + "]"; 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/reviews/review01/CarInfo.java: -------------------------------------------------------------------------------- 1 | package reviews.review01; 2 | 3 | /** 4 | * @author esalkan 5 | * @project java-notes 6 | */ 7 | 8 | public class CarInfo { 9 | public static void main(String[] args) { 10 | 11 | int year = 2021; 12 | String make = "Audi"; 13 | String model = "Q8"; 14 | String transmission = "Automatic"; 15 | String color = "white\\black"; 16 | int price = 100_000; 17 | 18 | System.out.println(year + " " + make + " " + model + " " + transmission + " " 19 | + " " + color + " " + price + "Euro"); 20 | 21 | } 22 | } -------------------------------------------------------------------------------- /src/reviews/review08/Login.java: -------------------------------------------------------------------------------- 1 | package reviews.review08; 2 | 3 | public class Login { 4 | 5 | public static void main(String[] args) { 6 | 7 | Credentials credentials = new Credentials(); 8 | 9 | // System.out.println(credentials.userName); Not reachable 10 | 11 | //credentials.passWord = "SPARTAAAAAA"; Not reachable 12 | 13 | System.out.println(credentials.getUserName()); 14 | System.out.println(credentials.getPassWord()); 15 | 16 | credentials.setPassWord("Neb&uchadnezzar324"); 17 | 18 | 19 | System.out.println("After changing : "+ credentials.getPassWord()); 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/reviews/review11/car_examples/Car.java: -------------------------------------------------------------------------------- 1 | package reviews.review11.car_examples; 2 | 3 | public abstract class Car extends Object{ 4 | 5 | public String model,make,color; 6 | public int year; 7 | 8 | 9 | 10 | public Car(String model, String color, int year) { 11 | this.model = model; 12 | this.color = color; 13 | this.year = year; 14 | } 15 | 16 | 17 | 18 | public abstract void start(); 19 | 20 | 21 | 22 | 23 | public String toString() { 24 | return "Car [model=" + model + ", make=" + make + ", color=" + color + ", year=" + year + "]"; 25 | } 26 | 27 | 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/core/JC13_methods_Part_1/JC12_passMultipleArguments.java: -------------------------------------------------------------------------------- 1 | package core.JC13_methods_Part_1; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC12_passMultipleArguments { 8 | /** 9 | * @param args 10 | */ 11 | public static void main(String[] args) { 12 | // showSum(int num1, int num2) 13 | showSum(5, 10); 14 | showSum(50, 20); 15 | showSum(60, 1); 16 | showSum(500, 100); 17 | } 18 | 19 | public static void showSum(int num1, int num2) { 20 | System.out.println(num1 + num2); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_test01/Question_14.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_test01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_14 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // What will be the output of this code? 16 | 17 | int temp = 65; 18 | int roomTemp = 72; 19 | int carTemp = 75; 20 | 21 | System.out.println(temp >= 65 && ((roomTemp == (temp += 2)) && (carTemp != temp))); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_14.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_14 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Solved & Passed 16 | 17 | // What will be the output of this code? 18 | 19 | int x = 3; 20 | int i = 0; 21 | while (i < 3) { 22 | x += 1; 23 | i += 1; 24 | } 25 | 26 | System.out.println(x); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/replit/oop/LameCalculatorClass.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.replit.oop; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class LameCalculatorClass { 8 | 9 | public static int plus(int a, int b) { 10 | return a + b; 11 | } 12 | 13 | public static int minus(int a, int b) { 14 | return a - b; 15 | } 16 | 17 | public static int multiply(int a, int b) { 18 | return a * b; 19 | } 20 | 21 | public static int divide(int a, int b) { 22 | return a / b; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/core/JC16_classObjects/JC03_task_cellPhoneClass.java: -------------------------------------------------------------------------------- 1 | package core.JC16_classObjects; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC03_task_cellPhoneClass { 8 | String brand; 9 | double screenSize; 10 | String color; 11 | double price; 12 | 13 | public void call() { 14 | System.out.println("Calling...."); 15 | } 16 | 17 | public void message() { 18 | System.out.println("Sending txt message...."); 19 | } 20 | 21 | public void takeAphoto() { 22 | System.out.println("Taking a photo"); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_15.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_15 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Solved & Passed 16 | 17 | // What will be the output of this code? 18 | 19 | int i = 0; 20 | 21 | while (i < 3) { 22 | System.out.println("hi"); 23 | i++; 24 | } 25 | 26 | System.out.println("bye"); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_variables/Question_01.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_variables; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_01 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // Declare and initialize an integer variable called count, 15 | // And write a statement that displays the value of count on the console 16 | 17 | int count = 54; 18 | System.out.println("Count is : " + count); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/exercises/shorts/_22_classObject/DogClassObject.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._22_classObject; 2 | 3 | public class DogClassObject { 4 | public static void main(String[] args) { 5 | DogClass dog1 = new DogClass(); 6 | 7 | dog1.name = "Bobi"; 8 | dog1.breed = "Kangal"; 9 | dog1.size = "XXL"; 10 | dog1.age = 9; 11 | dog1.color = "white-Gray"; 12 | 13 | dog1.eat(); 14 | dog1.play(); 15 | dog1.bark(); 16 | 17 | // to use that need toString() method in the reference class 18 | System.out.println(dog1); 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_print_and_println/Question_07.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_print_and_println; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_07 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | System.out.println(" /\\ /\\"); 15 | System.out.println("/__\\/__\\"); 16 | 17 | System.out.println("I'm from \"Germany\"."); 18 | System.out.println("How is your day going on, \'good\' or \'bad\' ?"); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa04_loops/Question_02.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa04_loops; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_02 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Solved 16 | 17 | // Write a program that displays all odd numbers between 3-130 in the same line 18 | 19 | for (int i = 3; i <= 130; i++) { 20 | if (i % 2 == 1) { 21 | System.out.println(i); 22 | } 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/core/JC12_branchingStatements/JC03_labeledStatements.java: -------------------------------------------------------------------------------- 1 | package core.JC12_branchingStatements; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC03_labeledStatements { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | int i = 0; 14 | 15 | outer: do { 16 | 17 | i = 8; 18 | 19 | inner: while (true) { 20 | 21 | System.out.println(i--); 22 | 23 | if (i == 4) { 24 | 25 | break outer; 26 | 27 | } 28 | 29 | } 30 | } while (true); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/core/reviews/week_01/_05_tellMeAboutYourSelf.java: -------------------------------------------------------------------------------- 1 | package core.reviews.week_01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class _05_tellMeAboutYourSelf { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // TODO Auto-generated method stub 15 | System.out.print("My name is ALKAN\n "); 16 | System.out.println("\t I live in Turkiye"); 17 | System.out.println("I \"learn JAVA\""); 18 | System.out.println("All of my effort in this path to be a SDET"); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/core/reviews/week_04/_11_salaryTest.java: -------------------------------------------------------------------------------- 1 | package core.reviews.week_04; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class _11_salaryTest { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | _10_salary shevki = new _10_salary(); 15 | shevki.setInfo(70, 45, 0.19); 16 | 17 | System.out.println(shevki.salaryAfterTax()); 18 | 19 | _10_salary hande = new _10_salary(); 20 | hande.setInfo(100, 35, 0.15); 21 | System.out.println(hande.salaryAfterTax()); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/exercises/interview_exercises/array_tasks/Array_MoveAllZerosToTheEnd.java: -------------------------------------------------------------------------------- 1 | package exercises.interview_exercises.array_tasks; 2 | 3 | public class Array_MoveAllZerosToTheEnd { 4 | 5 | /* 6 | write a program that can move all the zeros to the end of an array 7 | */ 8 | 9 | public static int[] moveZerosToTheEnd(int[] array) { 10 | 11 | int[] result = new int[array.length]; 12 | int count = 0; 13 | 14 | for (int each : array) { 15 | if (each != 0) 16 | result[count++] = each; 17 | } 18 | 19 | return result; 20 | 21 | } 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_29.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_29 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // What will be the output of this code? 16 | 17 | int amount = 10; 18 | 19 | String result = amount <= 2 ? "Couple" : amount > 2 && amount < 5 ? "few" : amount <= 5 ? "several" : "many"; 20 | System.out.println(result); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/reviews/review01/Shapes.java: -------------------------------------------------------------------------------- 1 | package reviews.review01; 2 | 3 | /** 4 | * @author esalkan 5 | * @project java-notes 6 | */ 7 | public class Shapes { 8 | // escape sequences 9 | // \t: paragraph space 10 | // \n: append new line 11 | // \" print " 12 | // \\ : prints \ 13 | 14 | public static void main(String[] args) { 15 | 16 | System.out.println("Make triangle\n---------------------------"); 17 | System.out.println("\tI want to start my triangle from here"); 18 | System.out.println("\t ^"); 19 | System.out.println("\t / \\\\"); 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/core/JC10_controlFlowStatements_Part_4/JC03_task_40_forLoop_evenNumbers.java: -------------------------------------------------------------------------------- 1 | package core.JC10_controlFlowStatements_Part_4; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC03_task_40_forLoop_evenNumbers { 8 | 9 | /** 10 | * @param args 11 | */ 12 | 13 | // Write a program that displays all even numbers between 1-100 in same line 14 | 15 | public static void main(String[] args) { 16 | for (int i = 1; i <= 100; i++) { 17 | if (i % 2 == 0) { 18 | System.out.print(i + ", "); 19 | } 20 | } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_test01/Question_16.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_test01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_16 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // What will be the output of this code? 16 | 17 | boolean b1 = false; 18 | boolean b2 = false; 19 | 20 | if ((b2 = b1) == false) { 21 | System.out.println("True"); 22 | } else { 23 | System.out.println("False"); 24 | } 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_test01/Question_24.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_test01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_24 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // What will be the output of this code? 16 | 17 | boolean b1 = false; 18 | boolean b2 = false; 19 | 20 | if (b2 != (b1 = !b2)) { 21 | System.out.println("True"); 22 | } else { 23 | System.out.println("False"); 24 | } 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_05.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_05 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Solved & Passed 16 | 17 | // What will be the output when running the following program? 18 | 19 | int i = 0; 20 | int j; 21 | for (j = 0; j < 10; j++) { 22 | i++; 23 | } 24 | 25 | System.out.println(i + " " + j); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/reviews/review09/inheritance/BookObjects.java: -------------------------------------------------------------------------------- 1 | package reviews.review09.inheritance; 2 | 3 | public class BookObjects { 4 | 5 | public static void main(String[] args) { 6 | 7 | 8 | AudioBook audioBook = new AudioBook(); 9 | audioBook.author = "Michiel Obama"; 10 | audioBook.title = "Becoming"; 11 | audioBook.price = 11.75; 12 | audioBook.narrator = "Random House Audio"; 13 | audioBook.lentgh = 15; 14 | audioBook.listen(); 15 | 16 | Ebook ebook = new Ebook(); 17 | ebook.author = "Yahya Kemal Beyatli"; 18 | ebook.title = "Kendi Gokkubbemiz Altinda"; 19 | ebook.readBook(); 20 | 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/reviews/review11/FinalKeyword.java: -------------------------------------------------------------------------------- 1 | package reviews.review11; 2 | 3 | public class FinalKeyword { 4 | 5 | final String name; 6 | final int age; 7 | final static String color ; // can be initialized at the same line or inside Static block 8 | 9 | 10 | public FinalKeyword(String name) { 11 | this.name = name; 12 | // this.color = color; Not possible 13 | } 14 | 15 | { 16 | this.age = 28; 17 | } 18 | 19 | static { 20 | color = "black"; 21 | } 22 | 23 | public static void main(String[] args) { 24 | 25 | final int x; // declare 26 | x= 10; 27 | System.out.println(x); 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/core/JC03_variables_dataTypes/JC05_task_05_variablesDataTypes.java: -------------------------------------------------------------------------------- 1 | package core.JC03_variables_dataTypes; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC05_task_05_variablesDataTypes { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | String name = "Eyüp Sabri ALKAN"; 14 | int age = 40; 15 | boolean isStudent = true; 16 | 17 | System.out.println("Student name is " + name + " & " + age + " years old." + " & " + "is he enroll the course? " 18 | + isStudent); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/core/JC13_methods_Part_1/JC11_passArguments.java: -------------------------------------------------------------------------------- 1 | package core.JC13_methods_Part_1; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC11_passArguments { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | // double x = 10.45; 14 | 15 | int a = 10; 16 | 17 | displayValue(a); 18 | 19 | // displayValue((int) x); 20 | 21 | // displayValue(x*4); 22 | } 23 | 24 | public static void displayValue(int num1) { 25 | 26 | System.out.println("The value is " + num1); 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/core/JC18_readingUserInput/JC02_userInput_2.java: -------------------------------------------------------------------------------- 1 | package core.JC18_readingUserInput; 2 | 3 | import java.util.Scanner; 4 | /** 5 | * @project Java Core & OOP Notes 6 | * @author esalkan 7 | * @github https://github.com/esalkan/java-notes 8 | */ 9 | public class JC02_userInput_2 { 10 | 11 | /** 12 | * @param args 13 | */ 14 | public static void main(String[] args) { 15 | 16 | Scanner sc = new Scanner(System.in); 17 | 18 | System.out.println("Provide a sentence and I will repeat it:"); 19 | // String str = sc.next(); 20 | 21 | String str2 = sc.nextLine(); 22 | 23 | System.out.println(str2); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/core/reviews/week_03/_02_basicLoopExamples.java: -------------------------------------------------------------------------------- 1 | package core.reviews.week_03; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class _02_basicLoopExamples { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | for (int i = 0; i < 10; i += 1) { 15 | System.out.println("Hello "); 16 | } 17 | 18 | System.out.println("\n+---------------------------------\n"); 19 | 20 | for (int i = 1; i <= 10; i++) { 21 | System.out.println("2 X " + i + " = " + (2 * i)); 22 | } 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa04_loops/Question_03.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa04_loops; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_03 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Solved 16 | 17 | // Write a program that displays the number of even numbers between 5 and 50 18 | // (included) 19 | 20 | for (int i = 5; i <= 50; i++) { 21 | if (i % 2 == 0) { 22 | System.out.println(i); 23 | } 24 | } 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/replit/basics/PrintVariable_1.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.replit.basics; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class PrintVariable_1 { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | // Solved and Test Cases Passed 14 | // Given an integer variable count write a statement that displays the value 15 | 16 | // do not change 17 | int count = 100; 18 | 19 | // your code here 20 | System.out.println(count); 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/core/JC05_unaryAssignmentRelationalLogicalOperators/JC04_task_20_unaryOperators.java: -------------------------------------------------------------------------------- 1 | package core.JC05_unaryAssignmentRelationalLogicalOperators; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC04_task_20_unaryOperators { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | int a = 1; 14 | a = -a-- + a++ / -a-- * --a; 15 | 16 | // a in memory = 1 - > 0 - > 0 - > -1 17 | // result = -1 + 0 / -1 * -1 = -1 + 0 * -1 = -1 + 0 = -1 18 | 19 | System.out.println(a); 20 | 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/core/JC13_methods_Part_1/JC03_simpleMethod.java: -------------------------------------------------------------------------------- 1 | package core.JC13_methods_Part_1; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC03_simpleMethod { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | System.out.println("Hello from main method..."); 14 | 15 | displayMessage(); 16 | 17 | System.out.println("Back in the main method..."); 18 | } 19 | 20 | private static void displayMessage() { 21 | 22 | System.out.println("Hello from the displayMessage() method..."); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/core/reviews/week_04/_16_garbageExample.java: -------------------------------------------------------------------------------- 1 | package core.reviews.week_04; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class _16_garbageExample { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | String str = "JAVA"; 15 | 16 | str = "python"; // "JAVA" object is unreferenced and eligible for garbage collection 17 | 18 | System.out.println(str); 19 | 20 | str = null; // "python" is unreferenced and eligible for garbage collection 21 | System.out.println(str); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_test01/Question_02.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_test01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_02 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // What will be the output of this code? 15 | 16 | String string1 = "Java Exercises"; 17 | String string2 = "do more " + string1; 18 | String string3 = string2; 19 | 20 | System.out.println("To able to be successful, we need to " + string3); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_17.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_17 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Solved & Passed 16 | 17 | // What will be the output of this code? 18 | 19 | int x = 20; 20 | 21 | while (x > 0) { 22 | do { 23 | x -= 2; 24 | } while (x > 5); 25 | } 26 | 27 | x--; 28 | 29 | System.out.println(x); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_variables/Question_02.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_variables; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_02 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // Declare and initialize a String variable called message, 15 | // And write a statement to display its value to console. 16 | 17 | String message = "Maraba Zalım Dunya / Hello Cruel World!"; 18 | 19 | System.out.println(message); 20 | 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/oop/JOOP38_InheritanceContinue/OOP01_SuperClass.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP38_InheritanceContinue; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | 9 | // Creating a Constructor it is our Parent Class 10 | public class OOP01_SuperClass { 11 | 12 | /** 13 | * In an inheritance relationship, the superclass constructor always executes 14 | * before the subclass constructor. 15 | */ 16 | 17 | // Creating a Constructor with no parameter 18 | public OOP01_SuperClass() { 19 | System.out.println("This is the super class Constructur"); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/reviews/review08/testEnvironment/Browser.java: -------------------------------------------------------------------------------- 1 | package reviews.review08.testEnvironment; 2 | 3 | public class Browser { 4 | 5 | private String browserType; 6 | 7 | public Browser() { 8 | 9 | } 10 | 11 | public Browser(String name) { 12 | browserType = name; // I do not need this. keyword 13 | } 14 | 15 | 16 | public String toString() { 17 | return "Browser [browserType=" + browserType + "]"; 18 | } 19 | 20 | public String getBrowserType() { 21 | return browserType; 22 | } 23 | 24 | public void setBrowserType(String browserType) { 25 | this.browserType = browserType; 26 | } 27 | 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/core/JC10_controlFlowStatements_Part_4/JC04_task_41_forLoop_oddNumbers.java: -------------------------------------------------------------------------------- 1 | package core.JC10_controlFlowStatements_Part_4; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC04_task_41_forLoop_oddNumbers { 8 | 9 | /** 10 | * @param args 11 | */ 12 | // odd = tek sayılar 13 | // Write a program that displays all odd numbers between 5-140 in same line 14 | 15 | public static void main(String[] args) { 16 | for (int i = 5; i <= 140; i++) { 17 | if (i % 2 == 1) { 18 | System.out.print(i + ", "); 19 | } 20 | } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/core/JC13_methods_Part_1/JC15_task_61_ageCalculator.java: -------------------------------------------------------------------------------- 1 | package core.JC13_methods_Part_1; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC15_task_61_ageCalculator { 8 | /** 9 | * @param args 10 | */ 11 | public static void main(String[] args) { 12 | // ageCalculator(int currentYear,int birthyear) 13 | ageCalculator(2019, 1965); 14 | ageCalculator(2019, 1875); 15 | } 16 | 17 | public static void ageCalculator(int currentYear, int birthyear) { 18 | int age = currentYear - birthyear; 19 | System.out.println(age); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/oop/JOOP33_Class_Objects_Constructors/OOP02_RectangleClass.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP33_Class_Objects_Constructors; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP02_RectangleClass { 9 | 10 | // Creating variables. 11 | // Their default value is 0.00 12 | double length; // default value is 0.00 13 | double width; // default value is 0.00 14 | 15 | // Creating a Method without return without parameter 16 | public void getArea() { 17 | // Just print what we send the print method 18 | System.out.println(length * width); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/oop/JOOP36_StaticClassMembers/OOP16_AllBlocksTest.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP36_StaticClassMembers; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP16_AllBlocksTest { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // run static blocks - 1 time 15 | 16 | // run all instance blocoks 17 | OOP15_AllBlocks o1 = new OOP15_AllBlocks(); 18 | 19 | System.out.println(); 20 | 21 | 22 | // run all instance blocks 23 | OOP15_AllBlocks o2 = new OOP15_AllBlocks(8); 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/reviews/review04/CalculatorOverLoading.java: -------------------------------------------------------------------------------- 1 | package reviews.review04; 2 | 3 | public class CalculatorOverLoading { 4 | 5 | public static void main(String[] args) { 6 | 7 | } 8 | 9 | public static double add(double num1, double num2) { 10 | double result = num1 + num2; 11 | return result; 12 | } 13 | 14 | public static double add(double num1, double num2,double num3) { // number of parameters 15 | double result = num1 + num2 + num3; 16 | return result; 17 | } 18 | 19 | public static int add(int num1, int num2) { // datatype of parameters 20 | int result = num1 + num2; 21 | return result; 22 | } 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/core/JC03_variables_dataTypes/JC10_task_10_variablesDataTypes.java: -------------------------------------------------------------------------------- 1 | package core.JC03_variables_dataTypes; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC10_task_10_variablesDataTypes { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | // Which of the followings are legal declarations? 14 | // Aşağıdakilerden hangisi doğru bir tanımlamadır? 15 | 16 | // boolean b1, b2; 17 | // String s1= "1", s2; 18 | // double d1, double d2; 19 | // int i1; int i2; 20 | // int i3; i4; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/core/JC11_controlFlowStatements_Part_5/JC11_task_52_whileLoops.java: -------------------------------------------------------------------------------- 1 | package core.JC11_controlFlowStatements_Part_5; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC11_task_52_whileLoops { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | // İnitialize a variable with value 25 14 | // Write a loop that will print "in the loop" while variable is more than 10 15 | int i = 25; 16 | 17 | while (i > 10) { 18 | 19 | System.out.println("in the loop"); 20 | 21 | i--; 22 | } 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_test01/Question_06.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_test01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_06 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // What will be the output of this code? 16 | 17 | int x1 = 50; 18 | int x2 = 75; 19 | 20 | boolean b = x1 >= x1; 21 | 22 | if (b = true) { 23 | System.out.println("Success"); 24 | } else { 25 | System.out.println("Failure"); 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_test01/Question_17.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_test01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_17 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // What will be the output of this code? 16 | 17 | int x1 = 50; 18 | int x2 = 75; 19 | 20 | boolean b = x1 >= x2; 21 | 22 | if (b == true) { 23 | System.out.println("Success"); 24 | } else { 25 | System.out.println("Failure"); 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_07.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_07 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Solved & Passed 16 | 17 | // What will be the output when running the following program? 18 | 19 | int sum = 0; 20 | for (int i = 0, j = 0; i > 20; ++i, --j) { 21 | sum = sum + i + j; 22 | } 23 | 24 | System.out.println("Sum = " + sum); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/oop/JOOP40_AccessModifiers_FinalKeyword_MethodHiding/Kangroo.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP40_AccessModifiers_FinalKeyword_MethodHiding; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Kangroo extends Marsupial{ 9 | 10 | // Careful Here there is Overriding 11 | /* 12 | @Override 13 | public boolean isBiped() { 14 | return true; 15 | } 16 | */ 17 | 18 | public static boolean isBiped() { 19 | return true; 20 | } 21 | 22 | public void getKangrooDescription() { 23 | System.out.println("Kangroo hops on two legs : " + isBiped()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/core/JC13_methods_Part_1/JC13_task_59_payCalculator.java: -------------------------------------------------------------------------------- 1 | package core.JC13_methods_Part_1; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC13_task_59_payCalculator { 8 | /** 9 | * @param args 10 | */ 11 | public static void main(String[] args) { 12 | 13 | // payCalculator(double hours,double hourlyPay) 14 | payCalculator(80, 20); 15 | payCalculator(37, 62.50); 16 | } 17 | 18 | public static void payCalculator(double hours, double hourlyPay) { 19 | double pay = hours * hourlyPay; 20 | System.out.println(pay); 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/core/reviews/week_03/_01_ternaryExample.java: -------------------------------------------------------------------------------- 1 | package core.reviews.week_03; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class _01_ternaryExample { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | int num1 = 100; 15 | int num2 = 10000; 16 | int biggerNumber; 17 | 18 | // if (num1>num2) { 19 | // biggerNumber = num1; 20 | // } else { 21 | // biggerNumber = num2; 22 | // } 23 | 24 | biggerNumber = (num1 > num2) ? num1 : num2; 25 | 26 | System.out.println(biggerNumber); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/oop/JOOP38_InheritanceContinue/OOP02_SubClass.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP38_InheritanceContinue; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | 9 | // This is subclass is a relationship with _01_SuperClass 10 | public class OOP02_SubClass extends OOP01_SuperClass { 11 | /** 12 | * In an inheritance relationship, the superclass constructor always executes 13 | * before the subclass constructor. 14 | */ 15 | 16 | // Creating a Constructor with no parameter 17 | public OOP02_SubClass() { 18 | System.out.println("This is the subclass constructor"); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/oop/JOOP40_AccessModifiers_FinalKeyword_MethodHiding/CarTest.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP40_AccessModifiers_FinalKeyword_MethodHiding; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class CarTest { 9 | public static void main(String[] args) { 10 | 11 | Car c = new Car(); 12 | c.model = "M3"; // model have default access modifier. 13 | c.year = 2021; // year have public access modifier. 14 | // c.door = 4; // door have private access modifier and accessable inside the same class 15 | c.engine = 2.2; // engine have protected access modifier. 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/oop/JOOP45_ExceptionsAndErrorHandling/Ex08_CheckedVsUnChecked.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP45_ExceptionsAndErrorHandling; 2 | 3 | /** 4 | * @author esalkan 5 | * @project java-notes 6 | */ 7 | public class Ex08_CheckedVsUnChecked { 8 | /** 9 | * @param args 10 | */ 11 | public static void main(String[] args) /* throws InterruptedException */ { // 2. Throws Declaration 12 | // Checked Exception : Need to handle to compile. 13 | // 1. way Try-Catch block 14 | try { 15 | Thread.sleep(2000); 16 | } catch (InterruptedException e) { 17 | e.printStackTrace(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/reviews/review04/LocalVsInstanceTest.java: -------------------------------------------------------------------------------- 1 | package reviews.review04; 2 | 3 | public class LocalVsInstanceTest { 4 | 5 | public static void main(String[] args) { 6 | 7 | LocalVsInstance obj = new LocalVsInstance(); 8 | 9 | System.out.println(" -----local variable-------"); 10 | obj.showDifference(); 11 | 12 | System.out.println("------instance variable-------"); 13 | obj.a=10; 14 | System.out.println(obj.a); 15 | 16 | 17 | 18 | for (int i = 0; i<10; i++) { // i is local to for loop 19 | System.out.println(i+" "); 20 | } 21 | // System.out.println(i); local variable can NOT print here 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/core/JC24_Arrays_Part_1/JC06_task_89_ShoppingList.java: -------------------------------------------------------------------------------- 1 | package core.JC24_Arrays_Part_1; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class JC06_task_89_ShoppingList { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | /** 15 | * Display each array element in the console by using for loop 16 | */ 17 | String[] shoppingList = { "cheese", "pumpkin", "bread", "eggs", "milk" }; 18 | 19 | for (int i = 0; i < shoppingList.length; i++) { 20 | 21 | System.out.println(shoppingList[i]); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_test01/Question_23.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_test01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_23 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // What will be the output of this code? 16 | 17 | int i = 5; 18 | int f = 6; 19 | int d = 3; 20 | int c = 1; 21 | 22 | if (i != f) { 23 | c++; 24 | } 25 | 26 | if ((f + d) == (c += 2)) { 27 | c--; 28 | } 29 | 30 | System.out.println(c); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/oop/JOOP36_StaticClassMembers/OOP17_Car.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP36_StaticClassMembers; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP17_Car { 9 | 10 | int door; 11 | 12 | public static void run() { 13 | System.out.println("Car is running."); 14 | } 15 | 16 | public int getDoorNumber() { 17 | return door + 2; 18 | } 19 | 20 | 21 | } 22 | 23 | class _17_CarTest{ 24 | /** 25 | * @param args 26 | */ 27 | public static void main(String[] args) { 28 | OOP17_Car c = new OOP17_Car(); 29 | c.run(); 30 | 31 | OOP17_Car.run(); 32 | } 33 | } -------------------------------------------------------------------------------- /src/core/JC16_classObjects/JC04_task_contactClass.java: -------------------------------------------------------------------------------- 1 | package core.JC16_classObjects; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC04_task_contactClass { 8 | 9 | String name; 10 | String phoneNumber; 11 | String email; 12 | 13 | public void call() { 14 | System.out.println("Calling " + name + " ...."); 15 | } 16 | 17 | public void sendMessage() { 18 | System.out.println("Sending message to " + phoneNumber + " | name: " + name); 19 | } 20 | 21 | public void sendEmail() { 22 | System.out.println("Sending email to " + email + " ...."); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/exercises/interview_exercises/array_tasks/Array_MergeTwoArrays.java: -------------------------------------------------------------------------------- 1 | package exercises.interview_exercises.array_tasks; 2 | 3 | public class Array_MergeTwoArrays { 4 | 5 | /* 6 | Write a return method that can concat two arrays 7 | */ 8 | 9 | public static int[] concatTwoArrays(int[] arr1, int[] arr2) { 10 | 11 | int[] result = new int[arr1.length + arr2.length]; 12 | 13 | int i = 0; 14 | for (int each : arr1) { 15 | result[i++] = each; 16 | } 17 | 18 | for (int each : arr2) { 19 | result[i++] = each; 20 | } 21 | 22 | return result; 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/exercises/interview_exercises/number_tasks/Number_SumOfDigitsOfInteger.java: -------------------------------------------------------------------------------- 1 | package exercises.interview_exercises.number_tasks; 2 | 3 | public class Number_SumOfDigitsOfInteger { 4 | 5 | /* 6 | write a function that can return the sum of digits of an integer Do not use any string manipulations 7 | Ex: 8 | input: 123 9 | output: 6 10 | 11 | */ 12 | 13 | 14 | public static int sumOfDigits(int number) { 15 | 16 | int sum = 0; 17 | 18 | while (number > 0) { 19 | sum += (number % 10); 20 | number /= 10; 21 | } 22 | 23 | return sum; 24 | } 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/core/JC02_printingComments/JC03_task_01_triangle.java: -------------------------------------------------------------------------------- 1 | package core.JC02_printingComments; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC03_task_01_triangle { 8 | /** 9 | * @param args 10 | */ 11 | public static void main(String[] args) { 12 | 13 | // Let's print a triangle of *'s on the screen. 14 | // Ekran üzerinde *'lardan oluşan bir üçgen yazdıralım. 15 | System.out.println(" *"); 16 | System.out.println(" * * "); 17 | System.out.println(" * *"); 18 | System.out.println(" * *"); 19 | System.out.println("*********"); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/core/JC16_classObjects/JC05_task_employeeClass.java: -------------------------------------------------------------------------------- 1 | package core.JC16_classObjects; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC05_task_employeeClass { 8 | 9 | String name; 10 | String jobTitle; 11 | double salary; 12 | 13 | public void work() { 14 | System.out.println(name + " is working hard..."); 15 | } 16 | 17 | public void attendMeeting() { 18 | System.out.println(name + " is attending a meeting..."); 19 | } 20 | 21 | public void introduce() { 22 | System.out.println("Name:" + name + "Job title:" + jobTitle + "Salary:" + salary); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/exercises/interview_exercises/string_tasks/String_RemoveDuplicates.java: -------------------------------------------------------------------------------- 1 | package exercises.interview_exercises.string_tasks; 2 | 3 | public class String_RemoveDuplicates { 4 | /* 5 | Write function that can remove the duplicated values from String 6 | Ex: removeDup("AAABBBCCC") ==> ABC 7 | */ 8 | 9 | public static String removeDup(String str) { 10 | String result = ""; 11 | 12 | for (int i = 0; i < str.length(); i++) { 13 | if (!result.contains("" + str.charAt(i))) { 14 | result += "" + str.charAt(i); 15 | } 16 | } 17 | 18 | return result; 19 | } 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_02.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_02 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Solved 16 | 17 | // Fill in the blank that Runs it 3 times using > to specify how many loops. 18 | // Decrement it with each iteration. 19 | 20 | // for (int i = 0; i >_____; i--) {} 21 | 22 | for (int i = 0; i > -3; i--) { 23 | System.out.println(i); 24 | } 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_11.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_11 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // // Solved & Not Passed 16 | // 17 | // // What will be the output of this code? 18 | // 19 | // do { 20 | // System.out.println("100"); 21 | // } while (true); 22 | // 23 | // System.out.println("Bye"); 24 | // 25 | // // error in the code !!! Why??? 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/oop/JOOP45_ExceptionsAndErrorHandling/Ex09_OrCatchBlock.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP45_ExceptionsAndErrorHandling; 2 | 3 | /** 4 | * @author esalkan 5 | * @project java-notes 6 | */ 7 | public class Ex09_OrCatchBlock { 8 | 9 | static String str; 10 | 11 | /** 12 | * @param args 13 | */ 14 | public static void main(String[] args) { 15 | // Handling Multiple Exceptions with One catch Block 16 | 17 | 18 | try { 19 | System.out.println(str.toUpperCase()); 20 | } catch (IllegalArgumentException | NullPointerException e){ // or some more exceptions 21 | e.printStackTrace(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/reviews/review04/ScrumTeam.java: -------------------------------------------------------------------------------- 1 | package reviews.review04; 2 | 3 | public class ScrumTeam { 4 | 5 | String companyName; 6 | int developers; 7 | int testers; 8 | double developerSalary; 9 | double testerSalary; 10 | double companyRevenue; 11 | 12 | public double costOfTheTeam() { 13 | return developers*developerSalary+testers*testerSalary; 14 | } 15 | 16 | 17 | 18 | public double returnOfInvestment() { 19 | return companyRevenue/costOfTheTeam(); 20 | } 21 | 22 | public void createCompany(String name, int devNums, int tesNums) { // setter method 23 | companyName = name; 24 | developers = devNums; 25 | testers = tesNums; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_08.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_08 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Solved & Passed 16 | 17 | // What will be the output when running the following program? 18 | 19 | int sum = 0; 20 | 21 | for (int i = 0; i < 10; i++) { 22 | if (i % 3 == 0) { 23 | sum = sum + i; 24 | } 25 | } 26 | 27 | System.out.println("Sum = " + sum); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/core/JC13_methods_Part_1/JC05_loopCallMethod.java: -------------------------------------------------------------------------------- 1 | package core.JC13_methods_Part_1; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC05_loopCallMethod { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | System.out.println("hello from the main method"); 14 | 15 | for (int i = 0; i < 5; i++) { 16 | 17 | displayMessage(); 18 | 19 | System.out.println("Back in the for loop"); 20 | } 21 | 22 | } 23 | 24 | public static void displayMessage() { 25 | System.out.println("Hello from displayMessage() method"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/core/JC21_stringClass_stringManipulation_Part_03/JC02_String_toLowerCase.java: -------------------------------------------------------------------------------- 1 | package core.JC21_stringClass_stringManipulation_Part_03; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class JC02_String_toLowerCase { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | /** 16 | * toLowerCase() Method 17 | * 18 | * --> toLowerCase() method returns the calling string value converted to lower 19 | * case. 20 | */ 21 | 22 | String word = "AUTOMATION"; 23 | System.out.println(word.toLowerCase()); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/core/JC27_Arrays_Part_4/JC04_loop2DArray.java: -------------------------------------------------------------------------------- 1 | package core.JC27_Arrays_Part_4; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class JC04_loop2DArray { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | int[][] numbers = { { 1, 2, 3 }, { 4, 5 }, { 7, 8, 9 } }; 16 | 17 | for (int rows = 0; rows < numbers.length; rows++) { 18 | for (int columns = 0; columns < numbers[rows].length; columns++) { 19 | System.out.print(numbers[rows][columns] + " "); 20 | } 21 | System.out.println(); 22 | } 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/core/reviews/week_03/customMethod.java: -------------------------------------------------------------------------------- 1 | package core.reviews.week_03; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class customMethod { 9 | public static void main(String[] args) { 10 | 11 | System.out.println(getAgeInDays(10) + " Days old. "); 12 | 13 | System.out.println(getAgeInDaysWithMSG(10)); 14 | } 15 | 16 | public static int getAgeInDays(int years) { 17 | 18 | // int days = years * 365; 19 | 20 | return years * 365; 21 | } 22 | 23 | public static String getAgeInDaysWithMSG(int years) { 24 | 25 | return (years * 365) + " Days old."; 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/replit/basics/PrintName.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.replit.basics; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class PrintName { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // Solved and Test Cases Passed 15 | // Suppose your name was Alan Turing. 16 | // Write a main method and a statement that would print 17 | // your last name, followed by a comma, 18 | // followed by a space and your first name. 19 | 20 | System.out.println("Turing, Alan ALKAN"); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/replit/basics/PrintVariable_2.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.replit.basics; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class PrintVariable_2 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // Solved and Test Cases Passed 15 | // Given a String variable message write a statement to display its value 16 | 17 | // do not change 18 | String message = "I am a SdetRoadMap school student."; 19 | 20 | // Write your code here: 21 | System.out.println(message); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/oop/JOOP37_Inheritance/OOP02_Student.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP37_Inheritance; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | 9 | // That class extending from Parent Class and it can use the parent class methods and variables 10 | public class OOP02_Student extends OOP01_Person { 11 | 12 | int studentId; 13 | String termClass; 14 | 15 | public void code(String lang) { 16 | 17 | System.out.println(name + " is coding " + lang); 18 | 19 | } 20 | 21 | public void attendClass() { 22 | 23 | System.out.println(name + " is attending " + termClass + " class"); 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/oop/JOOP40_AccessModifiers_FinalKeyword_MethodHiding/MethodHidingTestKangroo.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP40_AccessModifiers_FinalKeyword_MethodHiding; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class MethodHidingTestKangroo { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | Kangroo k = new Kangroo(); 16 | // Here we call from Child Class which is Kangroo from Parent Class which is 17 | // Marsupial getMarsupialDescription() 18 | k.getMarsupialDescription(); 19 | 20 | k.getKangrooDescription(); 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/core/JC07_controlFlowStatements_if_ifElse_Part_1/JC06_smallTasks_task_5_ifStatement2.java: -------------------------------------------------------------------------------- 1 | package core.JC07_controlFlowStatements_if_ifElse_Part_1; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC06_smallTasks_task_5_ifStatement2 { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | // 5- Write an if statement that prints Ideal Temp if the temp is 14 | // between 70 and 80 15 | int temperature = 75; 16 | 17 | if (temperature >= 70 && temperature <= 80) { 18 | System.out.println("Ideal Temp"); 19 | } 20 | 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/core/JC07_controlFlowStatements_if_ifElse_Part_1/JC13_ifElseStatement2.java: -------------------------------------------------------------------------------- 1 | package core.JC07_controlFlowStatements_if_ifElse_Part_1; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC13_ifElseStatement2 { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | int score = 60; 14 | 15 | if (score >= 70) { 16 | System.out.println("Excelent"); 17 | System.out.println("You Passed With Grade A"); 18 | } else { 19 | System.out.println("Your Score is : " + score); 20 | System.out.println("You fail"); 21 | } 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/core/reviews/week_04/_02_amazonTest_2.java: -------------------------------------------------------------------------------- 1 | package core.reviews.week_04; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class _02_amazonTest_2 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | System.out.println("--Starting Amazon Search Functional Test--"); 15 | _01_amazonTest.openBrowser(); 16 | _01_amazonTest.navigateToAmazonPage(); 17 | _01_amazonTest.searchForAnItem("Selenium"); 18 | _01_amazonTest.verifyResultsAreDisplayed(); 19 | System.out.println("Amazon Search Functional Test compeleted-PASS-"); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_13.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_13 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Not Solved & Passed 16 | 17 | // What will be the output of this code? 18 | 19 | int start = 1; 20 | int sum = 0; 21 | 22 | do { 23 | if (start % 2 == 0) { 24 | start++; 25 | } 26 | sum += start; 27 | } while (++start <= 10); 28 | 29 | System.out.println(sum); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/exercises/shorts/_26_accessModifier_01/AccessModifier.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts._26_accessModifier_01; 2 | 3 | public class AccessModifier { 4 | private static int n = 100; // Private 5 | static int n2 = 200; // Default 6 | public static int n3 = 300; // Public 7 | 8 | private static void method1(){ // Private 9 | System.out.println("Method with private access modifier"); 10 | } 11 | 12 | static void method2(){ // Default 13 | System.out.println("Method with default access modifier"); 14 | } 15 | 16 | public static void method3(){ // Public 17 | System.out.println("Method with public access modifier"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/oop/JOOP38_InheritanceContinue/OOP07_StaticSuper.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP38_InheritanceContinue; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | 9 | // Creating a Constructor Class 10 | public class OOP07_StaticSuper { 11 | 12 | // Creating a public static instance variable 13 | public static int num; 14 | 15 | // Creating a public static m1() Method 16 | public static void m1() { 17 | System.out.println("_06_StaticSuper.m1() called"); 18 | } 19 | 20 | // Creating a public m2() Method 21 | public void m2() { 22 | System.out.println("_06_StaticSuper.m2() called"); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/oop/JOOP41_Abstraction/Practice/Nokia.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP41_Abstraction.Practice; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Nokia extends MobilePhone { 9 | 10 | // Nokia class is first child class which is abstract class MobilePhone. That's 11 | // why need to add unimplemented methods from Parent abstract class. 12 | 13 | // implementation methods from Parent Abstract Class. Because Nokia is extends 14 | // MobilePhone 15 | @Override 16 | public void text() { 17 | // Code 18 | } 19 | 20 | @Override 21 | public void call() { 22 | // Code 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/reviews/review03/PrintAllLetters.java: -------------------------------------------------------------------------------- 1 | package reviews.review03; 2 | 3 | public class PrintAllLetters { 4 | 5 | public static void main(String[] args) { 6 | 7 | // Print all the letters from A to Z 8 | 9 | for (char c = 'A'; c <= 'Z'; c++) { 10 | System.out.print(c + " "); 11 | } 12 | 13 | System.out.println(""); 14 | for (int i=65; i<=90 ; i++) { 15 | System.out.print((char)i+" "); 16 | } 17 | 18 | System.out.println(""); 19 | 20 | for (int i = 'z'; i>='a'; i--) { // this is an example of implicit casting-compiler 21 | System.out.print((char)i+" "); // this is an example of explicit casting- we do it 22 | } 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/core/JC02_printingComments/JC08_commenting.java: -------------------------------------------------------------------------------- 1 | package core.JC02_printingComments; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC08_commenting { 8 | /** 9 | * @param args 10 | */ 11 | public static void main(String[] args) { 12 | // Commenting - Yorum Satırları 13 | 14 | // Author : ALKAN 15 | // Tekli Yorum Satırı 16 | // Time : 16:02 17 | /* Tekli yorum satırı olarak kullanılabilir. */ 18 | System.out.println("Hello World"); 19 | /* 20 | * Multiply Comment Line 21 | * Çoklu yorum satırı 22 | */ 23 | // System.out.println("Hello World"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/core/JC07_controlFlowStatements_if_ifElse_Part_1/JC02_smallTasks_task_1_ifStatement2.java: -------------------------------------------------------------------------------- 1 | package core.JC07_controlFlowStatements_if_ifElse_Part_1; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC02_smallTasks_task_1_ifStatement2 { 8 | 9 | /** 10 | * @param args 11 | */ 12 | 13 | // Write an if statement that assigns 5 to x when y is equal to 20 14 | 15 | public static void main(String[] args) { 16 | 17 | int x, y; 18 | x = 10; 19 | y = 10; 20 | 21 | if (y == 20) { 22 | x = 5; 23 | } 24 | 25 | System.out.println("x = " + x + " y = " + y); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/exercises/shorts/_36_throwsKeyword.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts; 2 | 3 | public class _36_throwsKeyword { 4 | 5 | public static void main(String[] args) throws InterruptedException { 6 | System.out.println("Hello"); 7 | 8 | try { 9 | Thread.sleep(3000); // Checked Exception 10 | } catch (InterruptedException e){ 11 | e.printStackTrace(); 12 | } 13 | 14 | System.out.println("World"); 15 | 16 | // with handle with that checked exception beside the method need to use 17 | // throws InterruptedException 18 | // just check the main method 19 | Thread.sleep(4000); 20 | 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/core/JC06_logicalOperators/JC04_task_unNumbered_3_logicalOperators.java: -------------------------------------------------------------------------------- 1 | package core.JC06_logicalOperators; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC04_task_unNumbered_3_logicalOperators { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | int b = 2; 14 | 15 | // False || True && False 16 | // False || False 17 | // Result is False 18 | boolean result = ++b == 2 || --b == 2 && --b == 2; 19 | 20 | System.out.println("int b = 2;\nboolean result = ++b == 2 || --b ==2 && --b == 2;\nResult is : " + result); 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/core/JC18_readingUserInput/JC05_task_72_sumNumbers.java: -------------------------------------------------------------------------------- 1 | package core.JC18_readingUserInput; 2 | 3 | import java.util.Scanner; 4 | /** 5 | * @project Java Core & OOP Notes 6 | * @author esalkan 7 | * @github https://github.com/esalkan/java-notes 8 | */ 9 | public class JC05_task_72_sumNumbers { 10 | 11 | /** 12 | * @param args 13 | */ 14 | public static void main(String[] args) { 15 | 16 | Scanner sc = new Scanner(System.in); 17 | 18 | System.out.println("Enter 3 numbers:"); 19 | int num1 = sc.nextInt(); 20 | int num2 = sc.nextInt(); 21 | int num3 = sc.nextInt(); 22 | int sum = num1 + num2 + num3; 23 | System.out.println("Sum of numbers:" + sum); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/core/JC19_stringClass_stringManipulation_Part_01/JC04_task_76_printingEachCharacters.java: -------------------------------------------------------------------------------- 1 | package core.JC19_stringClass_stringManipulation_Part_01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class JC04_task_76_printingEachCharacters { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Display each character in the console. 16 | // Last character index always length()-1 17 | 18 | String str = "Java Task 76"; 19 | 20 | for (int i = 0; i < str.length(); i++) { 21 | System.out.println(str.charAt(i)); 22 | } 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/exercises/interview_exercises/number_tasks/Number_FactorialNumber.java: -------------------------------------------------------------------------------- 1 | package exercises.interview_exercises.number_tasks; 2 | 3 | public class Number_FactorialNumber { 4 | 5 | /* 6 | Write a return method that returns the factorial number of any given number 7 | 8 | Ex: 9 | Input: 5 10 | outPut: 120 11 | 12 | because 5 * 4 * 3 * 2 * 1 = 120 13 | */ 14 | 15 | 16 | public static int factorialNumber(int n) { 17 | 18 | int result = 1; 19 | 20 | for (int i = 1; i <= n; i++) { 21 | result = result * i; 22 | } 23 | 24 | return result; 25 | 26 | } 27 | 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_18.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_18 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Solved & Not Passed 16 | 17 | // What will be the output of this code? 18 | 19 | int x = 0; 20 | while (x++ < 10) { 21 | 22 | } 23 | 24 | if (x > 10) { 25 | System.out.println("Greater" + "," + x); 26 | } else { 27 | System.out.println("Not Greater than" + "," + x); 28 | } 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa04_loops/Question_10.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa04_loops; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_10 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // Print following output using nested for loops: 15 | // 1 16 | // 22 17 | // 333 18 | // 4444 19 | // 55555 20 | // 666666 21 | // 7777777 22 | 23 | for (int i = 1; i <= 7; i++) { 24 | for (int j = 1; j <= i; j++) { 25 | System.out.print(i); 26 | } 27 | System.out.println(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_test01/Question_05.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_test01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_05 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // What will be the output of this code? 16 | 17 | int x = 4; 18 | int y = x * 4 - x++; 19 | 20 | if (y < 10) { 21 | System.out.println("Too Low"); 22 | } else if (y > 10 && y <= 15) { 23 | System.out.println("Just Right"); 24 | } else { 25 | System.out.println("Too High"); 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_test01/Question_12.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_test01; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class Question_12 { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | 14 | // What will be the output of this code? 15 | 16 | int i = 0; 17 | int j = 0; 18 | 19 | boolean t = true; 20 | boolean r; 21 | 22 | r = (t && 0 < (i += 1)); 23 | r = (t && 0 < (i += 2)); 24 | r = (t || 0 < (j += 1)); 25 | r = (t || 0 < (j += 2)); 26 | 27 | System.out.println(i + " " + j); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_test01/Question_13.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_test01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | *//** 8 | * @project Java Core & OOP Notes 9 | * @author esalkan 10 | * @github https://github.com/esalkan/java-notes 11 | */ 12 | public class Question_13 { 13 | 14 | /** 15 | * @param args 16 | */ 17 | public static void main(String[] args) { 18 | 19 | // What will be the output of this code? 20 | 21 | int x = 7; 22 | int m = 10; 23 | 24 | ++m; 25 | 26 | x = x-- + m--; 27 | 28 | System.out.println(x + " " + m); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/oop/JOOP34_Constructors_PassingObjectsToMethods/OOP05_Dice.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP34_Constructors_PassingObjectsToMethods; 2 | 3 | import java.util.Random; 4 | 5 | /** 6 | * @project Java Core & OOP Notes 7 | * @author esalkan 8 | * @github https://github.com/esalkan/java-notes 9 | */ 10 | public class OOP05_Dice { 11 | 12 | int sides; 13 | int value; 14 | 15 | public OOP05_Dice(int numSides) { 16 | sides = numSides; 17 | roll(); 18 | } 19 | 20 | public void roll() { 21 | Random rand = new Random(); 22 | value = rand.nextInt(sides) + 1; 23 | } 24 | 25 | public int getSides() { 26 | return sides; 27 | } 28 | 29 | public int getValue() { 30 | return value; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/reviews/review08/Employee.java: -------------------------------------------------------------------------------- 1 | package reviews.review08; 2 | 3 | public class Employee { 4 | 5 | public String name,jobTitle; 6 | public int ID; 7 | public double salary; // instance 8 | 9 | public static String companyName = "Microsoft"; // static variable, same copy for all my objects 10 | 11 | public Employee(String name, String jobTitle, int iD, double salary) { 12 | this.name = name; 13 | this.jobTitle = jobTitle; 14 | ID = iD; 15 | this.salary = salary; 16 | } 17 | 18 | 19 | public String toString() { 20 | return "Employee [name=" + name + ", jobTitle=" + jobTitle + ", ID=" + ID + ", salary=" + salary + "]"; 21 | } 22 | 23 | 24 | 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/core/JC07_controlFlowStatements_if_ifElse_Part_1/JC04_smallTasks_task_3_ifStatement2.java: -------------------------------------------------------------------------------- 1 | package core.JC07_controlFlowStatements_if_ifElse_Part_1; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC04_smallTasks_task_3_ifStatement2 { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | // Write an if statement that sets the variable fees to 50 if the Boolean 14 | // variable max is true 15 | boolean max = false; 16 | int fee = 20; 17 | 18 | if (max) { 19 | fee = 50; 20 | } 21 | 22 | System.out.println("Fee is " + fee); 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/core/JC10_controlFlowStatements_Part_4/JC06_task_43_forLoop_printTable.java: -------------------------------------------------------------------------------- 1 | package core.JC10_controlFlowStatements_Part_4; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC06_task_43_forLoop_printTable { 8 | 9 | /** 10 | * @param args 11 | */ 12 | 13 | // Write a program to print the number of table 14 | 15 | public static void main(String[] args) { 16 | System.out.println("Number\t\tNumber Squared"); 17 | System.out.println("------------------------------"); 18 | 19 | for (int i = 1; i <= 10; i++) { 20 | i++; 21 | System.out.println(i + "\t\t" + i * i); 22 | 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/core/JC11_controlFlowStatements_Part_5/JC03_nestedForLoopsTwo.java: -------------------------------------------------------------------------------- 1 | package core.JC11_controlFlowStatements_Part_5; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC03_nestedForLoopsTwo { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | for (int i = 0; i < 3; i++) { 14 | 15 | System.out.println("Outter Loop at state : " + i); 16 | 17 | for (int p = 0; p <= 3; p++) { 18 | 19 | System.out.println("Inner loop at state : " + p); 20 | 21 | if (p == 3) { 22 | 23 | System.out.println(); 24 | 25 | } 26 | } 27 | } 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/core/JC13_methods_Part_1/JC10_task_58_greaterNumber.java: -------------------------------------------------------------------------------- 1 | package core.JC13_methods_Part_1; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC10_task_58_greaterNumber { 8 | /** 9 | * @param args 10 | */ 11 | public static void main(String[] args) { 12 | findGreater(); 13 | } 14 | 15 | public static void findGreater() { 16 | int num1 = 50; 17 | int num2 = 10; 18 | if (num1 > num2) { 19 | System.out.println("num1 is greater"); 20 | } else if (num2 > num1) { 21 | System.out.println("num2 is greater"); 22 | } else { 23 | System.out.println("numbers are equal"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_print_and_println/Question_03.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_print_and_println; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_03 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | System.out.println(1); 15 | System.out.println(2); 16 | System.out.println(3); 17 | System.out.println(4); 18 | System.out.println(5); 19 | System.out.println(6); 20 | System.out.println(7); 21 | System.out.println(8); 22 | System.out.println(9); 23 | System.out.println(10); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_test01/Question_04.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_test01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_04 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // What will be the output of this code? 16 | 17 | int grade = 55; 18 | 19 | if (grade >= 40) { 20 | System.out.println("Congrat..."); 21 | if (grade < 60 || grade == 60) { 22 | System.out.println("You passed..."); 23 | } 24 | } else { 25 | System.out.println("You failed..."); 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_test01/Question_09.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_test01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_09 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // What will be the output of this code? 16 | 17 | int i, c; 18 | double d, f; 19 | 20 | i = 4; 21 | f = 4.3; 22 | d = 1.8; 23 | c = 0; 24 | 25 | if (i != c) { 26 | c++; 27 | if ((f + d) == (c += 2)) { 28 | System.out.println(c); 29 | } 30 | } 31 | 32 | System.out.println(c); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_06.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_06 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Solved & Passed 16 | 17 | // What will be the output when running the following program? 18 | 19 | int k = 0; 20 | int m = 0; 21 | 22 | for (int i = 0; i <= 3; i++) { 23 | k++; 24 | if (i == 2) { 25 | i = 4; 26 | } 27 | m++; 28 | } 29 | 30 | System.out.println(k + " " + m); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/core/JC11_controlFlowStatements_Part_5/JC02_nestedForLoop.java: -------------------------------------------------------------------------------- 1 | package core.JC11_controlFlowStatements_Part_5; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC02_nestedForLoop { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | 14 | for (int i = 1; i <= 5; i++) { 15 | 16 | System.out.println("Outer Loop Iteration : " + i); 17 | 18 | for (int j = 1; j <= 3; j++) { 19 | 20 | System.out.println("i = " + i + "; j = " + j); 21 | 22 | for (int j2 = 0; j2 < 2; j2++) { 23 | 24 | } 25 | } 26 | 27 | } 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/core/JavaCoreNotes.java: -------------------------------------------------------------------------------- 1 | package core; 2 | 3 | import java.util.ArrayList; 4 | 5 | /** 6 | * @project Java Core & OOP Notes 7 | * @author esalkan 8 | * @github https://github.com/esalkan/java-notes 9 | */ 10 | public class JavaCoreNotes { 11 | 12 | public static void main(String[] args) { 13 | 14 | 15 | 16 | for (String each : createVariables(10)) { 17 | 18 | 19 | } 20 | 21 | } 22 | 23 | public static ArrayList createVariables(int n){ 24 | ArrayList variables = new ArrayList(); 25 | 26 | for(int i = 0; i <= n; i++) { 27 | variables.add("variable"+i); 28 | } 29 | 30 | 31 | 32 | return variables; 33 | } 34 | 35 | } 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/core/reviews/week_01/_02_printStatements.java: -------------------------------------------------------------------------------- 1 | package core.reviews.week_01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class _02_printStatements { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // TODO Auto-generated method stub 15 | 16 | System.out.println("Hello, Welcome to JAVA"); 17 | 18 | System.out.println("Hi"); 19 | 20 | System.out.println("------------------------------------"); 21 | 22 | System.out.print("Hello, Welcome to JAVA"); 23 | 24 | System.out.println("Hi"); // print Hi to console than go to next line 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/exercises/interview_exercises/number_tasks/Number_DivideWithoutDivision.java: -------------------------------------------------------------------------------- 1 | package exercises.interview_exercises.number_tasks; 2 | 3 | public class Number_DivideWithoutDivision { 4 | 5 | /* 6 | Write a method that can divide two numbers without using division operator 7 | */ 8 | 9 | public static void divide(int num1, int num2) { 10 | if (num2 == 0) { 11 | System.out.println("Invalid Number"); 12 | return; 13 | } 14 | 15 | int count = 0; 16 | while (num1 >= num2) { 17 | num1 -= num2; 18 | count++; 19 | } 20 | System.out.println(count + " and remainder is " + num1); 21 | } 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_print_and_println/Question_05.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_print_and_println; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_05 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | System.out.println("* * * * * * *"); 15 | System.out.println("* * * *"); 16 | System.out.println("* * * *"); 17 | System.out.println("* * *"); 18 | System.out.println("* * * *"); 19 | System.out.println("* * * *"); 20 | System.out.println("* * * * * * *"); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/oop/JOOP42_Interface/Vehicle.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP42_Interface; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | 8 | /** 9 | * Implementing Interface 10 | * 11 | * • A class can extends another class and implements interface(s) same time. 12 | * 13 | * • If a class both extend a class and implement an interface, extends should 14 | * come first then implements keyword. 15 | * 16 | * public class Student extends Person implements Teachable, Dreamer{ 17 | * 18 | * } 19 | * 20 | */ 21 | public class Vehicle { 22 | 23 | public void drive() { 24 | System.out.println("Whicle is driving..."); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/core/JC09_controlFlowStatements_Part_3/JC04_task_39_switchCase.java: -------------------------------------------------------------------------------- 1 | package core.JC09_controlFlowStatements_Part_3; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC04_task_39_switchCase { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | String color = "o"; 14 | 15 | switch (color) { 16 | case "R": 17 | case "r": 18 | System.out.println("Red"); 19 | break; 20 | case "O": 21 | case "o": 22 | System.out.println("Orange"); 23 | break; 24 | case "G": 25 | case "g": 26 | System.out.println("Green"); 27 | break; 28 | } 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/core/JC13_methods_Part_1/JC02_studentMethod.java: -------------------------------------------------------------------------------- 1 | package core.JC13_methods_Part_1; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC02_studentMethod { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | sayHello(); 14 | study(); 15 | code(); 16 | } 17 | 18 | public static void sayHello() { 19 | System.out.println("Inside sayHello() Method"); 20 | } 21 | 22 | public static void code() { 23 | System.out.println("Student is studying..."); 24 | } 25 | 26 | public static void study() { 27 | System.out.println("Student is studying JAVA"); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/oop/JOOP37_Inheritance/OOP01_Person.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP37_Inheritance; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP01_Person { 9 | 10 | // Main, General, Parent Class 11 | public String name; // public 12 | int age; // default 13 | char gender; 14 | 15 | // Parent Class Methods 16 | public void eat(String food) { 17 | System.out.println(name + " is eating " + food); 18 | } 19 | 20 | public void walk() { 21 | System.out.println(name + " is walking"); 22 | } 23 | 24 | public void sleep(int hours) { 25 | System.out.println(name + " is sleeping for " + hours + " hours"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/core/reviews/week_01/_08_carInfo.java: -------------------------------------------------------------------------------- 1 | package core.reviews.week_01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class _08_carInfo { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // TODO Auto-generated method stub 15 | 16 | int year = 2021; 17 | String make = "Audi"; 18 | String model = "Q8"; 19 | String transmission = "Automatic"; 20 | String color = "white\\black"; 21 | int price = 100_000; 22 | 23 | System.out.println( 24 | year + " " + make + " " + model + " " + transmission + " " + " " + color + " " + price + "Euro"); 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_test01/Question_21.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_test01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_21 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // what will be the output of this code? 16 | 17 | char c = 'c'; 18 | 19 | switch (c) { 20 | case 'a': 21 | System.out.println("Apple"); 22 | case 'b': 23 | System.out.println("Bat"); 24 | break; 25 | case 'c': 26 | System.out.println("Cat"); 27 | default: 28 | System.out.println("None"); 29 | } 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_test02/Question_21.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_test02; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_21 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // Solved & Passed 16 | 17 | // What will be the output of this code? 18 | 19 | int c = 0; 20 | boolean flag = true; 21 | 22 | for (int i = 0; i < 8; i++) { 23 | while (flag) { 24 | c++; 25 | if (i > c || c > 3) { 26 | flag = false; 27 | } 28 | } 29 | } 30 | 31 | System.err.println(c); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/core/JC27_Arrays_Part_4/JC06_NestedForEachLoopIn2DArray.java: -------------------------------------------------------------------------------- 1 | package core.JC27_Arrays_Part_4; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class JC06_NestedForEachLoopIn2DArray { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | String[][] staff = { { "Ali", "Cihan", "Şamil", "Doğukan" }, { "Metin", "Semih", "Eray" }, 15 | { "Engin", "Naim", "Hüsnü", "Efraim", "Ali" } }; 16 | 17 | for (String[] persons : staff) { 18 | for (String person : persons) { 19 | System.out.print(person + " "); 20 | } 21 | System.out.println(); 22 | } 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_variables/Question_07.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_variables; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_07 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // Declare and initialize an integer variable i and a floating-point variable f. 15 | // Write a statement that writes both of their values to console in the 16 | // following format: 17 | // i=value-of-i , f=value-of-f 18 | 19 | int i = 54; 20 | float f = 54.61f; 21 | 22 | System.out.println("i=" + i + " , f=" + f); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/exercises/shorts/_23_constructorsThisKeyword.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts; 2 | 3 | public class _23_constructorsThisKeyword { 4 | /** 5 | * CONSTRUCTORS 6 | * 7 | * - Special method that every class must have 8 | * - It's used when we create objects of a class 9 | * - We can use constructors to initialize tha objects instance variables 10 | * - Execution of constructor always depends on the object. 11 | * 12 | * 13 | * CREATING; 14 | * - Constructor is a special method that matches the name of the class and has no return type nor a specifier. 15 | * 16 | * No-Argument Constructor / Default Constructor 17 | * Parameterized Constructors 18 | */ 19 | } 20 | -------------------------------------------------------------------------------- /src/reviews/review05/S09_FrequencyOfWord.java: -------------------------------------------------------------------------------- 1 | package reviews.review05; 2 | 3 | public class S09_FrequencyOfWord { 4 | 5 | public static void main(String[] args) { 6 | String sentence = "I am an experienced tester. As a tester I can automate browsers." 7 | + " I can test API and DB test"; 8 | String word = "test"; 9 | 10 | System.out.println(freqOfWord(sentence, word)); 11 | } 12 | 13 | 14 | public static int freqOfWord(String str, String word) { 15 | int count = 0; 16 | 17 | for (int i = 0; i <= str.length()-word.length();i++) { 18 | String each = str.substring(i, i+word.length()); 19 | if(each.equalsIgnoreCase(word)) { 20 | count++; 21 | } 22 | 23 | } 24 | 25 | return count; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/reviews/review06/A07_SentenceSplit.java: -------------------------------------------------------------------------------- 1 | package reviews.review06; 2 | 3 | public class A07_SentenceSplit { 4 | public static void main(String[] args) { 5 | 6 | String amazonResult = "1-48 x of x over x 6,000 x results x for x java"; 7 | 8 | 9 | String[] resultArray = amazonResult.split("x"); 10 | System.out.println(resultArray.length); 11 | System.out.println("How many results are there in my search: "+ resultArray[3] ); 12 | System.out.println("First element : "+ resultArray[0]); 13 | System.out.println("Second Element : "+ resultArray[1]); 14 | System.out.println("Number of 'x' in my statement : " + (resultArray.length-1) ); 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_test01/Question_22.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_test01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_22 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // What will be the output of this code? 16 | 17 | int x = (2 + 4 * 9 / 3) % 5; 18 | 19 | switch (x) { 20 | case 0: 21 | System.out.println("Hello"); 22 | default: 23 | System.out.println("World"); 24 | case 1: 25 | System.out.println("Good Bye"); 26 | break; 27 | case 2: 28 | System.out.println("Bye"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/oop/JOOP35_Encapsulation/OOP04_CarpetTest.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP35_Encapsulation; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP04_CarpetTest { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | OOP01_Floor f = new OOP01_Floor(10, 20); 16 | OOP02_Carpet c = new OOP02_Carpet(5.2); 17 | 18 | // _03_Calculator cal = new _03_Calculator(new _01_Floor(10, 20), new 19 | // _02_Carpet(5.2)); 20 | 21 | OOP03_Calculator cal = new OOP03_Calculator(f, c); // Objects belongs to Floor and Carpet Class. 22 | 23 | System.out.println(cal.getTotalCost()); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/core/reviews/week_06/_13_QuizExample.java: -------------------------------------------------------------------------------- 1 | package core.reviews.week_06; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class _13_QuizExample { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | int wd = 0; // -1, 0, 2, 4, 3 15 | String[] days = { "sun", "mon", "wed", "sat" }; 16 | 17 | for (int i = 0; i < days.length; i++) { 18 | switch (days[i]) { 19 | case "sat": 20 | case "sun": 21 | wd -= 1; 22 | break; 23 | case "mon": 24 | wd++; 25 | case "wed": 26 | wd += 2; 27 | 28 | } 29 | } 30 | 31 | System.out.println(wd); 32 | 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/exercises/shorts/_26_accessModifiers.java: -------------------------------------------------------------------------------- 1 | package exercises.shorts; 2 | 3 | public class _26_accessModifiers { 4 | 5 | /** 6 | * ACCESS MODIFIERS 7 | * 8 | * There are 4 access modifiers available in JAVA 9 | * 10 | * - public : Accessible from; Class, Package, SubClass, World (4) 11 | * - protected : Accessible from; Class, Package, SubClass (3) 12 | * - default : Accessible from; Class, Package (2) 13 | * - private : Accessible from; Class. (1) 14 | * 15 | * - Top level of Java class can have just 2 access modifiers, 1. public, 2. default 16 | * - Variables, constructors and methods can have all four access modifiers. 17 | */ 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/core/JC04_arithmethicOperators/JC08_task_15_convertMileToKilometer.java: -------------------------------------------------------------------------------- 1 | package core.JC04_arithmethicOperators; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC08_task_15_convertMileToKilometer { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | // Write a Java program to convert mile to kilometer. 14 | // Mil'i kilometreye dönüştürmek için bir Java programı yazın. 15 | 16 | double mile, km, convertingToKm; 17 | mile = 85.0; 18 | convertingToKm = mile * 1.609344; 19 | km = convertingToKm; 20 | 21 | System.out.println(mile + "Mile is equal to " + km + "Km"); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/core/JC07_controlFlowStatements_if_ifElse_Part_1/JC03_smallTasks_task_2_ifStatement2.java: -------------------------------------------------------------------------------- 1 | package core.JC07_controlFlowStatements_if_ifElse_Part_1; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC03_smallTasks_task_2_ifStatement2 { 8 | 9 | /** 10 | * @param args 11 | */ 12 | 13 | // Write an if statement that multiplies pay rate by 1.5 if hours is greater 14 | // than 40 15 | 16 | public static void main(String[] args) { 17 | double payRate = 1250; 18 | int hours = 45; 19 | 20 | if (hours > 40) { 21 | payRate = payRate * 1.5; 22 | } 23 | 24 | System.out.println("Payrate is : " + payRate); 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/core/JC07_controlFlowStatements_if_ifElse_Part_1/JC05_smallTasks_task_4_ifStatement2.java: -------------------------------------------------------------------------------- 1 | package core.JC07_controlFlowStatements_if_ifElse_Part_1; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC05_smallTasks_task_4_ifStatement2 { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | // Write an if statement that assigns 20 to the variable a if variable b is 50 14 | // and c is greater and equal to 100 15 | int a = 100; 16 | int b = 50; 17 | int c = 300; 18 | 19 | if (b == 50 || c > 100) { 20 | a = 20; 21 | } 22 | 23 | System.out.println("a = " + a); 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/core/JC13_methods_Part_1/JC07_deepAndDeeper.java: -------------------------------------------------------------------------------- 1 | package core.JC13_methods_Part_1; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC07_deepAndDeeper { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | System.out.println("I am starting in main"); 14 | deep(); 15 | System.out.println("Now I am back in main"); 16 | } 17 | 18 | public static void deep() { 19 | System.out.println("I am now in deep"); 20 | deeper(); 21 | System.out.println("Now I am back in deep"); 22 | } 23 | 24 | 25 | public static void deeper() { 26 | System.out.println("I am now in deeper"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/core/JC14_methods_Part_2/JC12_task_66_distanceTraveled.java: -------------------------------------------------------------------------------- 1 | package core.JC14_methods_Part_2; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC12_task_66_distanceTraveled { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | double d = distance(40, 5); 14 | System.out.println(d); 15 | if (d > 500) { 16 | System.out.println("You spent too much gas"); 17 | } else { 18 | System.out.println("You spent enough gas"); 19 | } 20 | } 21 | 22 | public static double distance(int speed, int time) { 23 | double distanceTraveled = speed * time; 24 | return distanceTraveled; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa02_variables/Question_03.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa02_variables; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_03 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // Declare two variables. One of them integer called num and the other one is 15 | // double called cost. 16 | // Print both values (num first, then cost), separated by a space on a single 17 | // line. 18 | 19 | int num = 54; 20 | double cost = 61.54; 21 | 22 | System.out.println("Num is : " + num + " Cost is : " + cost); 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa04_loops/Question_14.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa04_loops; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_14 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // Write nested loop to draw this pattern 15 | // 16 | // # # 17 | // # # 18 | // # # 19 | // # # 20 | // # # 21 | // # # 22 | // # # 23 | 24 | for (int i = 1; i <= 7; i++) { 25 | System.out.print("#"); 26 | for (int j = 1; j <= i; j++) { 27 | System.out.print(" "); 28 | } 29 | System.out.println("#"); 30 | } 31 | 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/oop/JOOP34_Constructors_PassingObjectsToMethods/OOP05_DiceTest.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP34_Constructors_PassingObjectsToMethods; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class OOP05_DiceTest { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | final int SIX_SIDES = 6; 16 | 17 | OOP05_Dice sixDice = new OOP05_Dice(SIX_SIDES); 18 | 19 | rollDice(sixDice); 20 | } 21 | 22 | public static void rollDice(OOP05_Dice d) { 23 | 24 | System.out.println("Rolling a " + d.getSides() + " sided dice."); 25 | 26 | System.out.println("The dice value " + d.getValue()); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/oop/JOOP45_ExceptionsAndErrorHandling/Ex05_TryCatchFinally.java: -------------------------------------------------------------------------------- 1 | package oop.JOOP45_ExceptionsAndErrorHandling; 2 | 3 | /** 4 | * @author esalkan 5 | * @project java-notes 6 | */ 7 | public class Ex05_TryCatchFinally { 8 | /** 9 | * @param args 10 | */ 11 | public static void main(String[] args) { 12 | String str = "Selenium"; 13 | 14 | try { 15 | System.out.println(str.length()); 16 | System.out.println(str.charAt(2)); 17 | } catch (Exception e){ 18 | System.out.println("Enter Correct Index Number"); 19 | } finally { 20 | System.out.println("Finally Block"); 21 | } 22 | 23 | System.out.println("Bye..."); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/reviews/review03/CustomMethods1.java: -------------------------------------------------------------------------------- 1 | package reviews.review03; 2 | 3 | public class CustomMethods1 { 4 | 5 | public static void main(String[] args) { 6 | 7 | int person1 = 10; 8 | if (person1>=21) { 9 | System.out.println("Eligible to buy"); 10 | }else { 11 | System.out.println("NOT Eligible to buy"); 12 | } 13 | 14 | int person2 = 20; 15 | if (person2>=21) { 16 | System.out.println("Eligible to buy"); 17 | }else { 18 | System.out.println("NOT Eligible to buy"); 19 | } 20 | 21 | int person3 = 24; 22 | if (person3>=21) { 23 | System.out.println("Eligible to buy"); 24 | }else { 25 | System.out.println("NOT Eligible to buy"); 26 | } 27 | 28 | 29 | 30 | 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/reviews/review13/FinallyBlock.java: -------------------------------------------------------------------------------- 1 | package reviews.review13; 2 | 3 | import java.util.InputMismatchException; 4 | import java.util.Scanner; 5 | 6 | public class FinallyBlock { 7 | 8 | public static void main(String[] args) { 9 | 10 | Scanner scan = new Scanner(System.in); 11 | 12 | try { 13 | System.out.println("Enter a number"); 14 | int num = scan.nextInt(); 15 | System.out.println("You entered : "+ num); 16 | }catch(InputMismatchException e) { 17 | System.out.println("Hey Buddy please read the message carefully"); 18 | }finally { 19 | scan.close(); // close and clean up the scanner 20 | System.out.println("Finally block runs no matter what"); 21 | } 22 | 23 | 24 | 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/core/JC03_variables_dataTypes/JC07_task_07_variablesDataTypes.java: -------------------------------------------------------------------------------- 1 | package core.JC03_variables_dataTypes; 2 | /** 3 | * @project Java Core & OOP Notes 4 | * @author esalkan 5 | * @github https://github.com/esalkan/java-notes 6 | */ 7 | public class JC07_task_07_variablesDataTypes { 8 | 9 | /** 10 | * @param args 11 | */ 12 | public static void main(String[] args) { 13 | // One line two variable declaration 14 | // Tek satırda iki değişken tanımlanması. 15 | int i1, i2; 16 | float f1; 17 | String s1; 18 | 19 | i1 = 10; 20 | i2 = 20; 21 | f1 = 12.5f; 22 | s1 = "Task-7"; 23 | 24 | System.out.println(i1); 25 | System.out.println(i2); 26 | System.out.println(f1); 27 | System.out.println(s1); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/qa01_test01/Question_28.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.qa01_test01; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Question_28 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | 15 | // What will be the output of this code? 16 | 17 | char grade = 'A'; 18 | 19 | boolean Passed = grade == 'A' || grade == 'B'; 20 | boolean Passed2 = grade == 'C' || grade == 'D'; 21 | 22 | if (Passed || Passed2) { 23 | System.out.println("You've passed the exam"); 24 | } else { 25 | System.out.println("You failed..."); 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/exercises/questionsANDanswers/replit/variables/Primitives_1.java: -------------------------------------------------------------------------------- 1 | package exercises.questionsANDanswers.replit.variables; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class Primitives_1 { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | // Solved and Test Cases Passed 15 | // Declare an integer variable named degreesCelsius but do not assign any value 16 | // Nothing else. Yes, its that simple! 17 | 18 | // WRITE YOUR CODE HERE: 19 | int degreesCelsius; 20 | 21 | // DO NOT TOUCH BELOW LINES. 22 | degreesCelsius = 35; 23 | System.out.println(degreesCelsius); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/core/JC25_Arrays_Part_2/JC05_sameArray.java: -------------------------------------------------------------------------------- 1 | package core.JC25_Arrays_Part_2; 2 | 3 | /** 4 | * @project Java Core & OOP Notes 5 | * @author esalkan 6 | * @github https://github.com/esalkan/java-notes 7 | */ 8 | public class JC05_sameArray { 9 | 10 | /** 11 | * @param args 12 | */ 13 | public static void main(String[] args) { 14 | int[] arry1 = { 1, 3, 5, 6, 7, 8, 9 }; 15 | int[] arry2 = arry1; 16 | 17 | arry1[0] = 300; 18 | arry2[1] = 1453; 19 | 20 | System.out.println("The Content Of Array 1 : "); 21 | for (int i : arry1) { 22 | System.out.print(i + " "); 23 | } 24 | 25 | System.out.println("\nThe Content Of Array 2 : "); 26 | 27 | for (int i : arry2) { 28 | System.out.print(i + ","); 29 | } 30 | } 31 | } 32 | --------------------------------------------------------------------------------