├── .gitignore ├── .idea ├── .gitignore ├── misc.xml ├── modules.xml ├── uiDesigner.xml └── vcs.xml ├── LearningATB7xJavaPrograms.iml ├── README.md └── src ├── aug ├── ex_04082024 │ ├── ATBPerson.java │ ├── BankAccount.java │ ├── Car.java │ ├── FatherElon.java │ ├── Lab162.java │ ├── Lab163.java │ ├── Lab164.java │ ├── Lab165.java │ ├── Lab166.java │ ├── Lab167.java │ ├── Lab168.java │ ├── Lab169.java │ ├── Lab170.java │ ├── Lab171.java │ ├── Lab173.java │ ├── Lab177.java │ ├── Person.java │ ├── accessModifiers │ │ ├── Lab176.java │ │ ├── criminal │ │ │ └── Thief.java │ │ └── police │ │ │ ├── Cop.java │ │ │ ├── JrCop.java │ │ │ └── Pramod.java │ ├── hasA │ │ ├── ex │ │ │ ├── Car.java │ │ │ ├── Engine.java │ │ │ └── Tyres.java │ │ └── isA │ │ │ └── Tesla.java │ ├── hierachicalinheritance │ │ ├── Father.java │ │ ├── Lab175.java │ │ ├── Lucky.java │ │ ├── Pramod.java │ │ └── Ruhani.java │ ├── multilevelinheritance │ │ ├── Child.java │ │ ├── Father.java │ │ ├── GrandFather.java │ │ └── Lab174.java │ ├── multipleinheritance │ │ ├── Child.java │ │ ├── Father.java │ │ ├── Lab176.java │ │ └── Mother.java │ ├── p1 │ │ └── Car.java │ ├── p2 │ │ └── Car.java │ ├── realTime │ │ └── Lab176.java │ └── singleheritance │ │ ├── Father.java │ │ ├── Lab172.java │ │ ├── Son.java │ │ ├── ex │ │ ├── Programming.java │ │ └── Python.java │ │ └── real │ │ ├── BaseTest.java │ │ ├── GrandBaseTest.java │ │ ├── TestCase.java │ │ └── TestCase2.java ├── ex_10082024 │ ├── RealTimeInheritance.java │ ├── ecap │ │ ├── ICICIBank.java │ │ ├── Lab178.java │ │ ├── Lab179.java │ │ ├── Lab180.java │ │ └── VWOLoginPage.java │ ├── poly │ │ ├── methodoveridding │ │ │ ├── Dog.java │ │ │ ├── Hound.java │ │ │ └── Lab182.java │ │ └── methodoverloading │ │ │ ├── Lab181.java │ │ │ └── MathOperations.java │ └── superthiskeyword │ │ ├── Lab183.java │ │ ├── Lab184.java │ │ └── Lab185.java ├── ex_11082024 │ ├── Lab186.java │ ├── Lab207.java │ ├── RealLIFEex │ │ ├── BaseClass.java │ │ ├── CHOMRE.java │ │ ├── FIREFOX.java │ │ ├── GrandBaseClass.java │ │ └── Lab189.java │ ├── exLoan │ │ ├── Father.java │ │ ├── Lab188.java │ │ └── Son.java │ ├── ex_interface │ │ ├── Engine.java │ │ ├── Lab190.java │ │ ├── Lab191.java │ │ ├── WagonR.java │ │ ├── ex2 │ │ │ ├── CarC.java │ │ │ ├── E.java │ │ │ └── PramodA.java │ │ ├── ex3 │ │ │ └── Lab192.java │ │ └── multipleinheritnace │ │ │ ├── Father.java │ │ │ ├── Lab192.java │ │ │ ├── Mother.java │ │ │ └── Son.java │ ├── excar │ │ ├── Car.java │ │ ├── Engine.java │ │ ├── GearBox.java │ │ ├── Keys.java │ │ ├── Lab187.java │ │ ├── Tesla.java │ │ ├── WagonR.java │ │ └── i10.java │ └── staticKeywrod │ │ ├── Lab193.java │ │ └── Lab194.java ├── ex_17082024 │ ├── APIConstants.java │ ├── BUG.java │ ├── COLORS.java │ ├── Lab195.java │ ├── Lab196.java │ ├── Lab197.java │ ├── Lab198.java │ ├── Lab199.java │ ├── Lab200.java │ ├── Lab201.java │ ├── Lab202.java │ ├── Lab203.java │ ├── Lab205.java │ ├── Lab206.java │ ├── Lab208.java │ ├── Lab209.java │ ├── Lab210.java │ ├── Lab211.java │ ├── Lab212.java │ ├── Lab213.java │ ├── Lab214.java │ ├── Lab215.java │ ├── Lab216.java │ ├── Lab217.java │ └── PAGES.java ├── ex_18082024 │ ├── Bank.java │ ├── CollectionFramework │ │ ├── Lab227.java │ │ ├── Lab228.java │ │ ├── Lab229.java │ │ ├── Lab230.java │ │ ├── Lab231.java │ │ ├── Lab232.java │ │ ├── Lab233.java │ │ ├── Lab234.java │ │ └── Lab235.java │ ├── Lab218.java │ ├── Lab219.java │ ├── Lab220.java │ ├── Lab221.java │ ├── Lab222.java │ ├── Lab223.java │ ├── Lab224.java │ ├── Lab225.java │ └── Lab226.java └── ex_24082024 │ ├── Lab236.java │ ├── Lab237.java │ ├── Lab238.java │ ├── Lab239.java │ ├── Lab240.java │ ├── Lab241.java │ ├── Lab242.java │ ├── Lab243.java │ ├── Lab244.java │ ├── Lab245.java │ ├── Lab246.java │ ├── Lab247.java │ ├── Lab248.java │ └── Lab249.java ├── july ├── ex_07072024 │ ├── $Lab010.java │ ├── Lab001.java │ ├── Lab002.java │ ├── Lab003.java │ ├── Lab004.java │ ├── Lab005.java │ ├── Lab006.java │ ├── Lab007.java │ ├── Lab008.java │ ├── Lab011.java │ ├── Lab012.java │ ├── Lab013.java │ ├── Lab014.java │ ├── Pramod123.java │ ├── Pramod_Dutta.java │ └── _Lab009.java ├── ex_13072024 │ ├── Lab015.java │ ├── Lab016.java │ ├── Lab017.java │ ├── Lab018.java │ ├── Lab019.java │ ├── Lab020.java │ ├── Lab021.java │ ├── Lab022.java │ ├── Lab023.java │ ├── Lab024.java │ ├── Lab025.java │ ├── Lab026.java │ ├── Lab027.java │ ├── Lab028.java │ ├── Lab029.java │ ├── Lab030.java │ ├── Lab031.java │ ├── Lab032.java │ ├── Lab033.java │ ├── Lab034.java │ ├── Lab035.java │ ├── Lab036.java │ ├── Lab037.java │ ├── Lab038.java │ ├── Lab039.java │ ├── Lab040.java │ ├── Lab041.java │ ├── Lab042.java │ ├── Lab043.java │ ├── Lab044.java │ ├── Lab045.java │ ├── Lab046.java │ ├── Lab047.java │ ├── Lab048.java │ └── Lab049.java ├── ex_14072024 │ ├── Lab050.java │ ├── Lab051.java │ ├── Lab052.java │ ├── Lab053.java │ ├── Lab054.java │ ├── Lab055.java │ ├── Lab056.java │ ├── Lab057.java │ ├── Lab058.java │ ├── Lab059.java │ ├── Lab060.java │ ├── Lab061.java │ ├── Lab062.java │ ├── Lab063.java │ ├── Lab064.java │ ├── Lab065.java │ ├── Lab066.java │ ├── Lab067.java │ ├── Lab068.java │ ├── Lab069.java │ ├── Lab070.java │ ├── Lab071.java │ ├── Lab072.java │ ├── Lab073.java │ ├── Lab074.java │ ├── Lab075.java │ ├── Lab076.java │ ├── Lab077.java │ ├── Lab078.java │ ├── Lab079.java │ ├── Lab080.java │ └── Lab081.java ├── ex_20072024 │ ├── Lab082.java │ ├── Lab083.java │ ├── Lab084.java │ ├── Lab085.java │ ├── Lab086.java │ ├── Lab087.java │ ├── Lab088.java │ ├── Lab089.java │ ├── Lab090.java │ ├── Lab091.java │ ├── Lab092.java │ ├── Lab093.java │ ├── Lab094.java │ ├── Lab095.java │ ├── Lab096.java │ ├── Lab097.java │ ├── Lab098.java │ ├── Lab099.java │ ├── Lab100.java │ ├── Lab101.java │ ├── Lab102.java │ ├── Lab103.java │ ├── Lab104.java │ └── Lab105.java ├── ex_21072024 │ ├── Lab106.java │ ├── Lab107.java │ ├── Lab108.java │ ├── Lab109.java │ ├── Lab110.java │ ├── Lab111.java │ ├── Lab112.java │ ├── Lab113.java │ ├── Lab114.java │ ├── Lab115.java │ ├── Lab116.java │ ├── Lab117.java │ ├── Lab118.java │ ├── Lab119.java │ ├── Lab120.java │ ├── Lab121.java │ ├── Lab122.java │ ├── Lab123.java │ ├── Lab124.java │ ├── Lab125.java │ ├── Lab126.java │ ├── Lab127.java │ ├── Lab128.java │ ├── Lab129.java │ ├── Lab130.java │ ├── Lab131.java │ ├── Lab132.java │ ├── Lab133.java │ ├── Lab134.java │ ├── Lab135.java │ └── Lab136.java ├── ex_27072024 │ ├── Lab137.java │ ├── Lab138.java │ ├── Lab139.java │ ├── Lab140.java │ ├── Lab141.java │ ├── Lab142.java │ ├── Lab143.java │ ├── Lab144.java │ ├── Lab145.java │ ├── Lab146.java │ ├── Lab147.java │ ├── Lab148.java │ ├── Lab149.java │ ├── Lab150.java │ ├── Lab151.java │ ├── Lab152.java │ └── Lab153.java └── ex_28072024 │ ├── Animal.java │ ├── Bank.java │ ├── BuildingBP.java │ ├── Car.java │ ├── Dog.java │ ├── Lab154.java │ ├── Lab155.java │ ├── Lab156.java │ ├── Lab157.java │ ├── Lab158.java │ ├── Lab159.java │ ├── Lab160.java │ ├── Lab161.java │ └── Person.java └── postman_collections ├── PreProd Env.postman_environment.json ├── QA Env.postman_environment.json ├── REST API Project#2 - Restful Booker.postman_collection.json └── integration_test ├── Project#1 - Restful Booker Integration Scenarios.postman_collection.json └── QA Env.postman_environment.json /.gitignore: -------------------------------------------------------------------------------- 1 | ### IntelliJ IDEA ### 2 | out/ 3 | !**/src/main/**/out/ 4 | !**/src/test/**/out/ 5 | 6 | ### Eclipse ### 7 | .apt_generated 8 | .classpath 9 | .factorypath 10 | .project 11 | .settings 12 | .springBeans 13 | .sts4-cache 14 | bin/ 15 | !**/src/main/**/bin/ 16 | !**/src/test/**/bin/ 17 | 18 | ### NetBeans ### 19 | /nbproject/private/ 20 | /nbbuild/ 21 | /dist/ 22 | /nbdist/ 23 | /.nb-gradle/ 24 | 25 | ### VS Code ### 26 | .vscode/ 27 | 28 | ### Mac OS ### 29 | .DS_Store -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LearningATB7xJavaPrograms.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Java Programs 2 | 3 | Author - Pramod 4 | 5 | This Repo contains the source code for the 6 | Exercise that we have done in the ATB7x batch 7 | 8 | - Core JAVA 9 | - OOPs 10 | - Collections Framework 11 | - Multi Threading 12 | - Design Patterns 13 | - FILE IO 14 | - Other misc concepts 15 | - Exception 16 | 17 | 18 | [Core Java.pdf](https://github.com/user-attachments/files/16118466/Core.Java.pdf) 19 | 20 | 21 | [[Java Notes] - TheTestingAcademy (Pramod Sir) (1).pdf](https://github.com/user-attachments/files/16118469/Java.Notes.-.TheTestingAcademy.Pramod.Sir.1.pdf) 22 | 23 | 24 | 25 | Postman Collection Also Added 26 | 27 | 28 | ![Screenshot 2024-09-08 at 10 54 31 AM](https://github.com/user-attachments/assets/d384319a-8e0c-45e8-9a9f-ab9636d89c7c) 29 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/ATBPerson.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024; 2 | 3 | public class ATBPerson { 4 | 5 | String name; 6 | long phone; 7 | 8 | // DC 9 | ATBPerson() { 10 | System.out.println("Object is created!"); 11 | } 12 | 13 | ATBPerson(String nameGiven){ 14 | this.name = nameGiven; 15 | // This current class. 16 | } 17 | 18 | ATBPerson(String nameGiven,long phoneNumber){ 19 | this.name = nameGiven; 20 | this.phone = phoneNumber; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/BankAccount.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024; 2 | 3 | public class BankAccount { 4 | String bankName; 5 | int balance; 6 | String bankCode; // Instance 7 | 8 | // DC 9 | BankAccount(){ 10 | bankName = "SBI"; 11 | balance = 0; 12 | bankCode = "SBI001"; 13 | } 14 | 15 | // PC - 3 Argument 16 | BankAccount(String bName,int bal, String bCode){ 17 | this.bankName = bName; 18 | this.balance = bal; 19 | this.bankCode = bCode; 20 | } 21 | 22 | BankAccount(String bName,int bal){ 23 | this.bankName = bName; 24 | this.balance = bal; 25 | 26 | } 27 | 28 | BankAccount(String bName){ 29 | this.bankName = bName; 30 | } 31 | 32 | 33 | void printDetails(){ 34 | System.out.println("Bank Name -> " + bankName); 35 | System.out.println("Bank Code -> " + bankCode); 36 | System.out.println("Bal ->" + balance); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/Car.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024; 2 | 3 | public class Car { 4 | 5 | // DC 6 | Car() { 7 | System.out.println("Starting"); 8 | 9 | } 10 | void Dog(){ 11 | 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/FatherElon.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024; 2 | 3 | public class FatherElon { 4 | class Son1{ 5 | class Son2{ 6 | 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/Lab162.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Lab162 { 6 | public static void main(String[] args) { 7 | // Constructors 8 | // 1. default - 70% 9 | // 2. Parameters - 25% 10 | // 3. Copy Constructors - ~ 1-4% 11 | // this vs super - why? they are used? 12 | // Static keyword and static methods 13 | 14 | 15 | // Constructors 16 | // 1. default - 70% 17 | // 2. Parameters - 25% 18 | // 3. Copy Constructors - ~ 1-4% 19 | 20 | 21 | 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/Lab163.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024; 2 | 3 | public class Lab163 { 4 | public static void main(String[] args) { 5 | Person p1 = new Person(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/Lab164.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024; 2 | 3 | public class Lab164 { 4 | public static void main(String[] args) { 5 | Car c1 = new Car(); 6 | // ClassName objectRef = new keyword + ClassName(); 7 | new Car(); 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/Lab165.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024; 2 | 3 | public class Lab165 { 4 | 5 | int e= 45; // Instance Variable != Global Variable 6 | 7 | void f1(){ 8 | int e = 10; // Local Variable 9 | System.out.println(e); 10 | } 11 | 12 | void f2(){ 13 | e = 50; 14 | System.out.println(e); 15 | } 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/Lab166.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024; 2 | 3 | public class Lab166 { 4 | String name; 5 | 6 | void talk(){} 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/Lab167.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024; 2 | 3 | public class Lab167 { 4 | public static void main(String[] args) { 5 | Lab166 a = new Lab166(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/Lab168.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024; 2 | 3 | public class Lab168 { 4 | public static void main(String[] args) { 5 | ATBPerson p1 = new ATBPerson(); 6 | new ATBPerson(); 7 | new ATBPerson(); 8 | ATBPerson p2 = null; 9 | //ATBPerson(); 10 | 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/Lab169.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024; 2 | 3 | public class Lab169 { 4 | public static void main(String[] args) { 5 | ATBPerson p0 = new ATBPerson(); 6 | ATBPerson p1 = new ATBPerson("Pramod"); 7 | ATBPerson p2 = new ATBPerson("Amit"); 8 | ATBPerson p3 = new ATBPerson("Praveen",976543210); 9 | System.out.println(p0.name); 10 | System.out.println(p1.name); 11 | System.out.println(p2.phone); 12 | 13 | 14 | 15 | System.out.println(p3.name); 16 | System.out.println(p3.phone); 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/Lab170.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024; 2 | 3 | import july.ex_28072024.Bank; 4 | 5 | import java.util.Scanner; 6 | 7 | public class Lab170 { 8 | public static void main(String[] args) { 9 | BankAccount ba1 = new BankAccount(); 10 | 11 | Scanner sc = new Scanner(System.in); 12 | System.out.println("Enter your Name of the Bank!"); 13 | String bName = sc.next(); 14 | System.out.println("Enter your Name of the Bal!"); 15 | int bal = sc.nextInt(); 16 | System.out.println("Enter your Name of the Bank cODE!"); 17 | 18 | String bCode = sc.next(); 19 | 20 | BankAccount baicici = new BankAccount(bName, bal, bCode); 21 | 22 | 23 | baicici.printDetails(); 24 | 25 | sc.close(); 26 | 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/Lab171.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024; 2 | 3 | public class Lab171 { 4 | 5 | // Objects are real entity - runtime entrites 6 | 7 | // Every Object will be different 8 | // Class - Name, age 9 | // DC -> WHO WILL initialize the value of the name or age? 10 | // Class loader - null, 0 11 | 12 | // Constructors - DC - hardcode the value 13 | // PC -> We can ask the user what you want to initialize. 14 | } 15 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/Lab173.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024; 2 | 3 | import aug.ex_04082024.p2.Car; 4 | 5 | public class Lab173 { 6 | public static void main(String[] args) { 7 | Car c1 = new Car(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/Lab177.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024; 2 | 3 | public class Lab177 { 4 | 5 | class Pramod{ 6 | class Lucky{ 7 | class AMit{ 8 | class Shardha{ 9 | 10 | } 11 | } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/Person.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024; 2 | 3 | public class Person { 4 | String name; 5 | 6 | // Special method 7 | Person(){ 8 | System.out.println("Hi, I will be called, Object is created!"); 9 | } 10 | 11 | 12 | void talk(){ 13 | System.out.println("I am talking"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/accessModifiers/Lab176.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.accessModifiers; 2 | 3 | // Non sub class 4 | public class Lab176 { 5 | // public 6 | // private 7 | // protected 8 | // default - nothing 9 | 10 | public static void main(String[] args) { 11 | 12 | } 13 | 14 | } 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/accessModifiers/criminal/Thief.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.accessModifiers.criminal; 2 | 3 | import aug.ex_04082024.accessModifiers.police.Cop; 4 | 5 | public class Thief { 6 | public static void main(String[] args) { 7 | Cop c = new Cop(100); 8 | //System.out.println(c.gun); 9 | //c.canIShoot(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/accessModifiers/police/Cop.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.accessModifiers.police; 2 | 3 | public class Cop { 4 | private int gun; 5 | private String idCard; 6 | 7 | public Cop(int gun){ 8 | this.gun = gun; 9 | } 10 | protected void canIShoot(){ 11 | System.out.println("Yes, You can!!"); 12 | } 13 | // protected = default - minor - 14 | } 15 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/accessModifiers/police/JrCop.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.accessModifiers.police; 2 | 3 | public class JrCop { 4 | public static void main(String[] args) { 5 | Cop cop = new Cop(10); 6 | cop.canIShoot(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/accessModifiers/police/Pramod.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.accessModifiers.police; 2 | 3 | public class Pramod { 4 | private String name; 5 | private int id; 6 | // Instance should be well protected. 7 | 8 | private void talk(){} // 9 | // only class within the same pacakage can see us 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/hasA/ex/Car.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.hasA.ex; 2 | 3 | public class Car { 4 | // Aggregation - hasA 5 | protected void StartTheCar(){ 6 | new Engine().start(); 7 | new Tyres().rolling(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/hasA/ex/Engine.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.hasA.ex; 2 | 3 | public class Engine { 4 | void start(){ 5 | System.out.println("Starting engine"); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/hasA/ex/Tyres.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.hasA.ex; 2 | 3 | public class Tyres { 4 | void rolling(){ 5 | System.out.println("Rolling Types"); 6 | } 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/hasA/isA/Tesla.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.hasA.isA; 2 | 3 | import aug.ex_04082024.hasA.ex.Car; 4 | // isA - 5 | public class Tesla extends Car { 6 | void start(){ 7 | StartTheCar(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/hierachicalinheritance/Father.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.hierachicalinheritance; 2 | 3 | public class Father { 4 | void home(){ 5 | System.out.println("3BHK"); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/hierachicalinheritance/Lab175.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.hierachicalinheritance; 2 | 3 | public class Lab175 { 4 | public static void main(String[] args) { 5 | Ruhani r = new Ruhani(); 6 | r.home(); 7 | r.r1(); 8 | 9 | Pramod pramod = new Pramod(); 10 | pramod.home(); 11 | 12 | pramod.h2(); 13 | 14 | Lucky l = new Lucky(); 15 | l.l2(); 16 | l.home(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/hierachicalinheritance/Lucky.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.hierachicalinheritance; 2 | 3 | public class Lucky extends Father { 4 | void l2(){ 5 | System.out.println("Lucky"); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/hierachicalinheritance/Pramod.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.hierachicalinheritance; 2 | 3 | public class Pramod extends Father{ 4 | 5 | void h2(){ 6 | System.out.println("h2 - Pramod"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/hierachicalinheritance/Ruhani.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.hierachicalinheritance; 2 | 3 | public class Ruhani extends Father{ 4 | void r1(){ 5 | System.out.println("ruhani"); 6 | } 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/multilevelinheritance/Child.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.multilevelinheritance; 2 | 3 | public class Child extends Father{ 4 | void home(){ 5 | System.out.println("3BHK"); 6 | } 7 | 8 | void c(){ 9 | System.out.println("C"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/multilevelinheritance/Father.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.multilevelinheritance; 2 | 3 | public class Father extends GrandFather{ 4 | 5 | void home(){ 6 | System.out.println("2BHK"); 7 | 8 | } 9 | void extra(){ 10 | System.out.println("Extra"); 11 | } 12 | void f(){ 13 | System.out.println("F"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/multilevelinheritance/GrandFather.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.multilevelinheritance; 2 | 3 | public class GrandFather { 4 | void home(){ 5 | System.out.println("1BHK"); 6 | } 7 | 8 | void gf(){ 9 | System.out.println("GF"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/multilevelinheritance/Lab174.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.multilevelinheritance; 2 | 3 | public class Lab174 { 4 | public static void main(String[] args) { 5 | // Multi Level 6 | // GF -> F -> Child 7 | Child c1 = new Child(); 8 | c1.home(); // If name is same C -> F -> GF 9 | c1.c(); 10 | c1.gf(); 11 | c1.f(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/multipleinheritance/Child.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.multipleinheritance; 2 | 3 | public class Child //extends Father,Mother 4 | { 5 | void C(){ 6 | // home(); 7 | // money(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/multipleinheritance/Father.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.multipleinheritance; 2 | 3 | public class Father { 4 | void home(){ 5 | System.out.println("3BHK"); 6 | } 7 | void money(){ 8 | System.out.println("1 CR"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/multipleinheritance/Lab176.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.multipleinheritance; 2 | 3 | public class Lab176 { 4 | // You get something from both the parents 5 | public static void main(String[] args) { 6 | Child c = new Child(); 7 | //c.home(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/multipleinheritance/Mother.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.multipleinheritance; 2 | 3 | public class Mother { 4 | void home(){ 5 | System.out.println("2BHK"); 6 | } 7 | void money(){ 8 | System.out.println("1.5 CR"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/p1/Car.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.p1; 2 | 3 | public class Car { 4 | public Car(){ 5 | System.out.println("Hello"); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/p2/Car.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.p2; 2 | 3 | public class Car { 4 | public Car(){ 5 | System.out.println("Hello"); 6 | } 7 | } -------------------------------------------------------------------------------- /src/aug/ex_04082024/realTime/Lab176.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.realTime; 2 | 3 | public class Lab176 { 4 | // Bank , ICICI -> store information 5 | // Bank and ICICI -> is A- icici - bank - extends 0 inheritance 6 | // Bank has customers - hasA 7 | 8 | // Programming Python,Java, -> ISa 9 | 10 | 11 | // Laptop, keyborad, mouse, camera -> HasA 12 | 13 | // isA or HasA -> Aggrestio 14 | } 15 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/singleheritance/Father.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.singleheritance; 2 | 3 | public class Father // Super Class 4 | { 5 | void bhk2(){ 6 | System.out.println("2BHK"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/singleheritance/Lab172.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.singleheritance; 2 | 3 | public class Lab172 { 4 | public static void main(String[] args) { 5 | Son s = new Son(); 6 | s.bhk3(); 7 | s.bhk2(); 8 | 9 | Father f1 = new Father(); 10 | f1.bhk2(); 11 | 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/singleheritance/Son.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.singleheritance; 2 | 3 | // Sub Class 4 | public class Son extends Father{ 5 | // IS A - RELATIONSHIP 6 | 7 | void bhk3() { 8 | System.out.println("3BHK"); 9 | //son can use father's surname but father cannot use son surname 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/singleheritance/ex/Programming.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.singleheritance.ex; 2 | 3 | public class Programming { 4 | int version; 5 | String author; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/singleheritance/ex/Python.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.singleheritance.ex; 2 | 3 | public class Python extends Programming{ 4 | // DC 5 | Python(){ 6 | System.out.println("DC Python"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/singleheritance/real/BaseTest.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.singleheritance.real; 2 | 3 | public class BaseTest extends GrandBaseTest{ 4 | 5 | void startBrowser(){ 6 | System.out.println("Staring Browser!!"); 7 | } 8 | 9 | void closeBrowser(){ 10 | System.out.println("Closing Browser!!"); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/singleheritance/real/GrandBaseTest.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.singleheritance.real; 2 | 3 | public class GrandBaseTest { 4 | int gold = 3; 5 | void getDataFromSQL(){ 6 | System.out.println("MYSQL Connected"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/singleheritance/real/TestCase.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.singleheritance.real; 2 | 3 | public class TestCase extends BaseTest{ 4 | 5 | void testCase(){ 6 | startBrowser(); 7 | // Here we will write the TC 8 | closeBrowser(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/aug/ex_04082024/singleheritance/real/TestCase2.java: -------------------------------------------------------------------------------- 1 | package aug.ex_04082024.singleheritance.real; 2 | 3 | public class TestCase2 extends BaseTest{ 4 | 5 | void testCase2(){ 6 | startBrowser();// BaseTest 7 | getDataFromSQL(); // GrandBaseTest 8 | System.out.println(gold); // GrandBaseTest 9 | // Here we will write the TC 10 | closeBrowser(); 11 | } 12 | 13 | public static void main(String[] args) { 14 | new TestCase2().testCase2(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/aug/ex_10082024/RealTimeInheritance.java: -------------------------------------------------------------------------------- 1 | package aug.ex_10082024; 2 | 3 | public class RealTimeInheritance { 4 | public static void main(String[] args) { 5 | BaseClass t1 = new TestCase1(); // Dynamic Dispatch // Runtime 6 | //t1.setBrowser("opera",true); 7 | t1.openBrowser(); 8 | t1.closeBrowser(); 9 | 10 | } 11 | } 12 | 13 | 14 | class TestCase1 extends BaseClass{ 15 | // TestCase is A Type of BaseCalss - Single Inheritance 16 | TestCase1(){ 17 | super(); // DC of Parent 18 | this.setBrowser("edge",true); 19 | } 20 | 21 | @Override 22 | public void setBrowser(String browser, boolean isAuth) { 23 | super.setBrowser(browser, isAuth); 24 | } 25 | } 26 | 27 | class BaseClass{ 28 | BaseClass(){ 29 | System.out.println("DC - BaseClass"); 30 | } 31 | BaseClass(String b){ 32 | System.out.println("CC - BaseClass"); 33 | } 34 | 35 | private String browser; 36 | 37 | public String getBrowser() { 38 | return browser; 39 | } 40 | 41 | public void setBrowser(String browser, boolean isAuth) { 42 | if (isAuth) { 43 | this.browser = browser; 44 | }else{ 45 | System.out.println("Not Allowed"); 46 | } 47 | } 48 | 49 | 50 | void openBrowser() { 51 | System.out.println("Chrome Browser!!"); 52 | } 53 | 54 | void openBrowser(String browserName) { 55 | System.out.println("Open Browser!! -> " + browserName); 56 | } 57 | void closeBrowser() { 58 | System.out.println("Close Browser!!"); 59 | } 60 | 61 | } -------------------------------------------------------------------------------- /src/aug/ex_10082024/ecap/ICICIBank.java: -------------------------------------------------------------------------------- 1 | package aug.ex_10082024.ecap; 2 | 3 | public class ICICIBank { 4 | 5 | //## Encapsulation 6 | //- Encapsulation is a fundamental concept in object-oriented programming (OOP). 7 | //- Bundling of data and methods that operate on that data within a single unit. 8 | //- Data members should be private in nature. 9 | //- Methods with getter and setter only, you can access the data members / attributes. 10 | 11 | private String name; 12 | private long bal; 13 | 14 | public ICICIBank(String name, long bal) { 15 | this.name = name; 16 | this.bal = bal; 17 | } 18 | 19 | public long getBal(boolean isAdmin) { 20 | if (isAdmin) { 21 | return bal; 22 | } else { 23 | return 0; 24 | } 25 | } 26 | 27 | public void setBal(long bal, boolean isAdmin) { 28 | if (isAdmin) { 29 | this.bal = bal; 30 | System.out.println("Allowed"); 31 | } else { 32 | System.out.println("Not Allowed!"); 33 | } 34 | } 35 | 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name, boolean isAdmin) { 41 | if (isAdmin) { 42 | this.name = name; 43 | System.out.println("Allowed"); 44 | } else { 45 | System.out.println("Not Allowed!"); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/aug/ex_10082024/ecap/Lab178.java: -------------------------------------------------------------------------------- 1 | package aug.ex_10082024.ecap; 2 | // ## Encapsulation 3 | public class Lab178 { 4 | public static void main(String[] args) { 5 | VWOLogin vwoLogin = new VWOLogin("admin","password123"); 6 | System.out.println(vwoLogin.password); 7 | vwoLogin.password = "123"; 8 | System.out.println(vwoLogin.password); 9 | } 10 | } 11 | 12 | class VWOLogin{ 13 | public String username; 14 | public String password; 15 | 16 | public VWOLogin(String username, String password) { 17 | this.username = username; 18 | this.password = password; 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /src/aug/ex_10082024/ecap/Lab179.java: -------------------------------------------------------------------------------- 1 | package aug.ex_10082024.ecap; 2 | // ## Fixed Encapsulation 3 | public class Lab179 { 4 | public static void main(String[] args) { 5 | VWOLogin1 vwoLogin = new VWOLogin1("admin","password123"); 6 | System.out.println(vwoLogin.getUsername()); 7 | vwoLogin.setUsername("pramod"); 8 | System.out.println(vwoLogin.getUsername()); 9 | 10 | // Write a code to Auth 11 | // Pramod - isAuth = true 12 | vwoLogin.setPassword("1234",false); 13 | 14 | 15 | 16 | } 17 | } 18 | 19 | class VWOLogin1{ 20 | // Data Members 21 | private String username; 22 | private String password; 23 | 24 | public String getUsername() { 25 | return username; 26 | } 27 | 28 | public void setUsername(String username) { 29 | this.username = username; 30 | } 31 | 32 | public String getPassword() { 33 | return password; 34 | } 35 | 36 | public void setPassword(String password,boolean isAuth) { 37 | if(isAuth) { 38 | this.password = password; 39 | }else { 40 | System.out.println("Not Allowed!"); 41 | } 42 | } 43 | 44 | public VWOLogin1(String username, String password) { 45 | this.username = username; 46 | this.password = password; 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /src/aug/ex_10082024/ecap/Lab180.java: -------------------------------------------------------------------------------- 1 | package aug.ex_10082024.ecap; 2 | 3 | public class Lab180 { 4 | public static void main(String[] args) { 5 | 6 | ICICIBank amit = new ICICIBank("Amit",100); 7 | // set the balance 8 | // admin 9 | 10 | // amit.name = "dasdd"; 11 | amit.setBal(1000000000,false); 12 | //amit.setBal(); 13 | System.out.println(amit.getName()); 14 | 15 | 16 | System.out.println(amit.getBal(false)); 17 | 18 | 19 | 20 | // Write a code to connect with mySQL 21 | // Admin 22 | boolean are_you_admin = true; 23 | 24 | 25 | ICICIBank admin = new ICICIBank("admin",1000); 26 | admin.setBal(50000,true); 27 | System.out.println(admin.getName()); 28 | System.out.println(admin.getBal(are_you_admin)); 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/aug/ex_10082024/ecap/VWOLoginPage.java: -------------------------------------------------------------------------------- 1 | package aug.ex_10082024.ecap; 2 | 3 | public class VWOLoginPage { 4 | private String username; 5 | private String password; 6 | private String signINButton; 7 | 8 | public String getPassword() { 9 | return password; 10 | } 11 | 12 | public String getSignINButton() { 13 | return signINButton; 14 | } 15 | 16 | public String getUsername() { 17 | return username; 18 | } 19 | 20 | public void setUsername(String username) { 21 | this.username = username; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/aug/ex_10082024/poly/methodoveridding/Dog.java: -------------------------------------------------------------------------------- 1 | package aug.ex_10082024.poly.methodoveridding; 2 | 3 | public class Dog { 4 | void bark(){ 5 | System.out.println("I am Dog, i will Bark!!"); 6 | } 7 | int age = 10; 8 | } 9 | -------------------------------------------------------------------------------- /src/aug/ex_10082024/poly/methodoveridding/Hound.java: -------------------------------------------------------------------------------- 1 | package aug.ex_10082024.poly.methodoveridding; 2 | 3 | public class Hound extends Dog { 4 | 5 | @Override 6 | void bark(){ 7 | System.out.println("I am Hound, i will Bark!!"); 8 | } 9 | 10 | void bike(){ 11 | System.out.println("Biked"); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/aug/ex_10082024/poly/methodoveridding/Lab182.java: -------------------------------------------------------------------------------- 1 | package aug.ex_10082024.poly.methodoveridding; 2 | 3 | public class Lab182 { 4 | // Method overidding | Runtime Poly 5 | public static void main(String[] args) { 6 | Hound h1 = new Hound(); 7 | h1.bark(); 8 | h1.bike(); 9 | 10 | Dog d1 = new Dog(); 11 | d1.bark(); 12 | 13 | Dog dog_Ref = new Hound(); 14 | dog_Ref.bark(); // Overriden Functions 15 | //dog_Ref.bike(); 16 | 17 | //Hound h2 = new Dog(); 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/aug/ex_10082024/poly/methodoverloading/Lab181.java: -------------------------------------------------------------------------------- 1 | package aug.ex_10082024.poly.methodoverloading; 2 | 3 | public class Lab181 { 4 | // Polymorphism 5 | 6 | public static void main(String[] args) { 7 | MathOperations mathOperations = new MathOperations(); 8 | int result = mathOperations.add(2,3); 9 | double result2 = mathOperations.add(2.4,3.6); 10 | String result3 = mathOperations.add("Pramod","Dutta"); 11 | String result4 = mathOperations.add("Pramod",123); 12 | //String result4 = mathOperations.add("Pramod",12.34); 13 | System.out.println(result); 14 | System.out.println(result2); 15 | System.out.println(result3); 16 | System.out.println(result4); 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/aug/ex_10082024/poly/methodoverloading/MathOperations.java: -------------------------------------------------------------------------------- 1 | package aug.ex_10082024.poly.methodoverloading; 2 | 3 | public class MathOperations { 4 | 5 | // Encapsulation 6 | private String name; 7 | 8 | public String getName() { 9 | return name; 10 | } 11 | 12 | public void setName(String name) { 13 | this.name = name; 14 | } 15 | 16 | int add(int a, int b) { 17 | return a + b; 18 | } 19 | 20 | // Method Overloading 21 | int add(int pramod, int dutta, int amit, int mehga) { 22 | return pramod + dutta; 23 | } 24 | 25 | void add(int a, int b, int c) { 26 | System.out.println("Hello"); 27 | } 28 | 29 | double add(double a, double b) { 30 | return a + b; 31 | } 32 | 33 | double add(double a, double b, float f) { 34 | return a + b + f; 35 | } 36 | 37 | String add(String a, String b) { 38 | return a + b; 39 | } 40 | 41 | String add(String a, int b) { 42 | return a + b; 43 | } 44 | 45 | String add(int b, String a) { 46 | return a + b; 47 | } 48 | 49 | MathOperations() { 50 | } 51 | 52 | MathOperations(int a) { 53 | } 54 | 55 | MathOperations(int a, int b) { 56 | } 57 | 58 | MathOperations(int a, int b, int c) { 59 | } 60 | 61 | MathOperations(int a, int b, int c, String d) { 62 | } 63 | 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/aug/ex_10082024/superthiskeyword/Lab183.java: -------------------------------------------------------------------------------- 1 | package aug.ex_10082024.superthiskeyword; 2 | 3 | public class Lab183 { 4 | // super() 5 | //1. Use of super with Variables 6 | //2. Use of super with Methods 7 | //3. Use of super with constructors 8 | 9 | // super keyword in Java is a reference variable that allows 10 | // a subclass - child class 11 | // to refer to its parent class. 12 | public static void main(String[] args) { 13 | Car s = new Car(); 14 | s.display(); 15 | } 16 | 17 | 18 | } 19 | 20 | class Car extends Vehicle { 21 | private int maxSpeed = 281; 22 | 23 | Car(){ 24 | super(10); // Constructor Chaining 25 | System.out.println("DC Car"); 26 | 27 | } 28 | 29 | public void display(){ 30 | System.out.println("Car speed is -> "+ this.maxSpeed); 31 | System.out.println("Vehicle speed is -> "+ super.maxSpeed); 32 | super.message(); 33 | this.message(); 34 | 35 | } 36 | 37 | @Override 38 | void message() { 39 | System.out.println("Hello Vehicle"); 40 | } 41 | 42 | } 43 | 44 | class Vehicle { 45 | public int maxSpeed = 180; 46 | 47 | Vehicle(){ 48 | System.out.println("DC Vehicle"); 49 | } 50 | Vehicle(int a){ 51 | System.out.println("PC Vehicle"); 52 | } 53 | 54 | 55 | void message() { 56 | System.out.println("Hello Vehicle"); 57 | } 58 | 59 | void message(int a) { 60 | System.out.println("Hello Vehicle"); 61 | } 62 | 63 | 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/aug/ex_10082024/superthiskeyword/Lab184.java: -------------------------------------------------------------------------------- 1 | package aug.ex_10082024.superthiskeyword; 2 | 3 | public class Lab184 { 4 | } 5 | 6 | 7 | class Student extends Person { 8 | // is A relation - inheritance 9 | @Override 10 | void message() { 11 | System.out.println("I am Student message"); 12 | } 13 | 14 | void display() { 15 | super.message(); 16 | } 17 | 18 | 19 | } 20 | 21 | class Person { 22 | void message() { 23 | System.out.println("I am person message"); 24 | } 25 | } -------------------------------------------------------------------------------- /src/aug/ex_10082024/superthiskeyword/Lab185.java: -------------------------------------------------------------------------------- 1 | package aug.ex_10082024.superthiskeyword; 2 | 3 | public class Lab185 { 4 | 5 | // super.variable 6 | // super.method() 7 | // super() -> DC 8 | // super("pramod') -> PC 9 | 10 | // this() 11 | // this.variableName 12 | 13 | 14 | 15 | } 16 | 17 | class Person1 { 18 | Person1() { 19 | System.out.println("Person1 - DC"); 20 | } 21 | 22 | Person1(String a) { 23 | System.out.println("Person1 - PC A1"); 24 | } 25 | 26 | Person1(String a, int a1) { 27 | System.out.println("Person1 - PC A2"); 28 | } 29 | } 30 | class Student1 extends Person1{ 31 | int a = 10; 32 | Student1(String s){ 33 | System.out.println("PC -Student"); 34 | } 35 | 36 | Student1(){ 37 | super(); 38 | System.out.println(this.a); 39 | //super("Pramod"); 40 | //super("pramod",12); 41 | } 42 | 43 | 44 | } -------------------------------------------------------------------------------- /src/aug/ex_11082024/Lab186.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024; 2 | 3 | public class Lab186 { 4 | public static void main(String[] args) { 5 | 6 | } 7 | } 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/Lab207.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024; 2 | 3 | import aug.ex_17082024.COLORS; 4 | 5 | public class Lab207 { 6 | public static void main(String[] args) { 7 | System.out.println("Color Code "+ COLORS.RED); 8 | System.out.println("Color Code "+ COLORS.RED.getValue()); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/RealLIFEex/BaseClass.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.RealLIFEex; 2 | 3 | abstract class BaseClass extends GrandBaseClass { 4 | // Web Automation 5 | // Single 6 | // Hide the Functionality of the open and close Browser. 7 | 8 | abstract String openBrowser(String browser); 9 | abstract String closeBrowser(String browser); 10 | BaseClass(){} 11 | 12 | @Override 13 | void takeScreenShot() { 14 | System.out.println("Ok Taking ScreenShot"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/RealLIFEex/CHOMRE.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.RealLIFEex; 2 | 3 | public class CHOMRE extends BaseClass{ 4 | @Override 5 | String openBrowser(String browser) { 6 | System.out.println("Open the Chrome ....., // This is code releted to chrome only\n"); 7 | return browser; 8 | } 9 | 10 | @Override 11 | String closeBrowser(String browser) { 12 | return ""; 13 | } 14 | 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/RealLIFEex/FIREFOX.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.RealLIFEex; 2 | 3 | public class FIREFOX extends BaseClass { 4 | @Override 5 | String openBrowser(String browser) { 6 | System.out.println("Open the FIREFOX ....., // This is code releted to FIREFOX only\n"); 7 | return browser; 8 | } 9 | 10 | @Override 11 | String closeBrowser(String browser) { 12 | System.out.println("Closing the FIREFOX ....., // This is code releted to FIREFOX only\n"); 13 | return ""; 14 | } 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/RealLIFEex/GrandBaseClass.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.RealLIFEex; 2 | 3 | abstract class GrandBaseClass { 4 | abstract void takeScreenShot(); 5 | 6 | GrandBaseClass(){} 7 | 8 | // new GrandBaseClass(); 9 | } 10 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/RealLIFEex/Lab189.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.RealLIFEex; 2 | 3 | public class Lab189 { 4 | public static void main(String[] args) { 5 | CHOMRE c = new CHOMRE(); 6 | String s = c.openBrowser("Chrome"); 7 | System.out.println(s); 8 | c.closeBrowser("Chrome"); 9 | 10 | FIREFOX f = new FIREFOX(); 11 | f.openBrowser("ff"); 12 | f.closeBrowser("ff"); 13 | f.takeScreenShot(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/exLoan/Father.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.exLoan; 2 | 3 | abstract class Father { 4 | abstract void loan50K(); 5 | 6 | void loan25k(){ 7 | System.out.println("Done by Father Already"); 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/exLoan/Lab188.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.exLoan; 2 | 3 | public class Lab188 { 4 | public static void main(String[] args) { 5 | Son s1 = new Son(); 6 | s1.loan50K(); 7 | 8 | Father f1 = new Son(); 9 | f1.loan25k(); 10 | f1.loan50K(); 11 | 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/exLoan/Son.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.exLoan; 2 | 3 | public class Son extends Father { 4 | @Override 5 | void loan50K() { 6 | System.out.println("I will give the Loan 50K"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/ex_interface/Engine.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.ex_interface; 2 | 3 | public interface Engine { 4 | void startEngine(); // Incomplete 5 | void stopEngine(); // Incomplete 6 | } 7 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/ex_interface/Lab190.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.ex_interface; 2 | 3 | public class Lab190 { 4 | // Interface - Hide the implementation 5 | // Interface variables will be inherited to subclasses. 6 | // interface is a keyword which is used to define User Defined Datatypes. 7 | 8 | 9 | public static void main(String[] args) { 10 | // Engine e = new Engine(); 11 | WagonR r = new WagonR(); 12 | r.drive(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/ex_interface/Lab191.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.ex_interface; 2 | 3 | public class Lab191 { 4 | public static void main(String[] args) { 5 | // I i = new I(): 6 | 7 | } 8 | } 9 | 10 | interface I{} 11 | class A{} // con 12 | class B{} 13 | abstract class C{} 14 | class Test1 extends A{} // Ok? 15 | class Test2 extends B{} 16 | // class Test3 extends A,B{} // Multiple Inheritance 17 | class Test0 implements I{} 18 | interface I1{ } 19 | interface I2{} 20 | class Test4 implements I1,I2{} // multiple Inheritance with interface 21 | class Test5 extends A implements I1,I2{} 22 | //class Test6 implements I1 extends A{}// Ok 23 | //interface I3 extends A{} 24 | //interface I4 implements A{} 25 | //interface I5 extends A,B{} 26 | interface I6 extends I1,I2{} 27 | //interface I7 extends C{} -------------------------------------------------------------------------------- /src/aug/ex_11082024/ex_interface/WagonR.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.ex_interface; 2 | 3 | public class WagonR implements Engine{ 4 | 5 | void drive(){ 6 | startEngine(); 7 | stopEngine(); 8 | } 9 | 10 | @Override 11 | public void startEngine() { 12 | System.out.println("Wagon R i starting"); 13 | } 14 | 15 | @Override 16 | public void stopEngine() { 17 | System.out.println("Wagon R i Stopping"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/ex_interface/ex2/CarC.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.ex_interface.ex2; 2 | 3 | public class CarC implements E{ 4 | @Override 5 | public void startEngine() { 6 | 7 | } 8 | 9 | @Override 10 | public void stopEngine() { 11 | 12 | } 13 | 14 | @Override 15 | public void m2() { 16 | 17 | } 18 | 19 | @Override 20 | public void m3() { 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/ex_interface/ex2/E.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.ex_interface.ex2; 2 | 3 | public interface E { 4 | void startEngine(); 5 | 6 | void stopEngine(); 7 | 8 | default void haltingEngineJustStart() { 9 | System.out.println("Halt the Engine"); 10 | } 11 | 12 | default void haltingEngineJustStop() { 13 | System.out.println("Halt the Engine"); 14 | } 15 | 16 | static void M1() { 17 | System.out.println("M1"); 18 | } 19 | 20 | void m2(); 21 | void m3(); 22 | // void m4(){ 23 | // System.out.println("Not possible"); 24 | // } 25 | } 26 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/ex_interface/ex2/PramodA.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.ex_interface.ex2; 2 | 3 | abstract class PramodA { 4 | 5 | abstract void m1(); 6 | void m2(){ 7 | 8 | } 9 | } 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/ex_interface/ex3/Lab192.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.ex_interface.ex3; 2 | 3 | import java.security.Key; 4 | 5 | public class Lab192 { 6 | public static void main(String[] args) { 7 | Car c = new Car(); 8 | c.start(); 9 | c.m1(); 10 | } 11 | } 12 | 13 | interface Eng{ 14 | void start(); 15 | default void m1(){ 16 | System.out.println("Old M1"); 17 | } 18 | 19 | default void suite(){ 20 | System.out.println("wear suite"); 21 | } 22 | } 23 | 24 | interface GearBox extends Eng{ 25 | void gear(); 26 | 27 | } 28 | 29 | interface Keys extends GearBox{ 30 | void openCar(); 31 | } 32 | 33 | 34 | 35 | class Car implements Keys { 36 | 37 | @Override 38 | public void start() { 39 | System.out.println("Starting"); 40 | } 41 | 42 | @Override 43 | public void gear() { 44 | 45 | } 46 | 47 | @Override 48 | public void openCar() { 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/ex_interface/multipleinheritnace/Father.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.ex_interface.multipleinheritnace; 2 | 3 | interface Father { 4 | void loan(); 5 | void loan(String a); 6 | void home(); 7 | 8 | static void m1(){ 9 | System.out.println("Let me explain"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/ex_interface/multipleinheritnace/Lab192.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.ex_interface.multipleinheritnace; 2 | 3 | public class Lab192 { 4 | public static void main(String[] args) { 5 | Son s1 = new Son(); 6 | s1.loan(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/ex_interface/multipleinheritnace/Mother.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.ex_interface.multipleinheritnace; 2 | 3 | //interface to interface extends 4 | //class to class extends 5 | //interface to class implements 6 | interface Mother { 7 | void loan(); 8 | void loan(String b, String c); 9 | } 10 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/ex_interface/multipleinheritnace/Son.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.ex_interface.multipleinheritnace; 2 | 3 | public class Son implements Father,Mother{ 4 | 5 | @Override 6 | public void loan() { 7 | System.out.println("This is only One Function"); 8 | } 9 | 10 | @Override 11 | public void loan(String b, String c) { 12 | System.out.println("String b, String c"); 13 | } 14 | 15 | @Override 16 | public void loan(String a) { 17 | System.out.println("String a"); 18 | } 19 | 20 | @Override 21 | public void home() { 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/excar/Car.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.excar; 2 | 3 | class Car extends Engine { 4 | // Engine 5 | // GearBox 6 | // Keys 7 | 8 | // Tesla is A Car 9 | // Tesla - DRIVE() 10 | 11 | 12 | @Override 13 | void openCar() { 14 | System.out.println("Open Car with keys"); 15 | } 16 | 17 | @Override 18 | void partGearBox() { 19 | System.out.println("Part of GearBox"); 20 | } 21 | 22 | @Override 23 | void stop() { 24 | System.out.println("Stop a Car"); 25 | } 26 | 27 | @Override 28 | void speed() { 29 | System.out.println("Car"); 30 | } 31 | 32 | @Override 33 | void start() { 34 | System.out.println("Start a Car"); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/excar/Engine.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.excar; 2 | 3 | abstract class Engine extends GearBox{ 4 | // Incomplete class 5 | abstract void start(); 6 | abstract void stop(); 7 | abstract void speed(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/excar/GearBox.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.excar; 2 | 3 | abstract class GearBox extends Keys { 4 | abstract void partGearBox(); 5 | } 6 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/excar/Keys.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.excar; 2 | 3 | abstract class Keys { 4 | abstract void openCar(); 5 | } 6 | 7 | 8 | class ConcreateClass{ 9 | // no keyword of abstract in the area 10 | } 11 | 12 | abstract class IncompleteAbstractClass{ 13 | abstract void f1(); 14 | abstract String f2(); 15 | abstract boolean f3(); 16 | abstract long f4(); 17 | } -------------------------------------------------------------------------------- /src/aug/ex_11082024/excar/Lab187.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.excar; 2 | 3 | public class Lab187 { 4 | public static void main(String[] args) { 5 | 6 | 7 | Tesla t = new Tesla(); 8 | t.drive(); 9 | 10 | System.out.println(" --- --- "); 11 | WagonR wagonR = new WagonR(); 12 | wagonR.drive(); 13 | 14 | 15 | 16 | 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/excar/Tesla.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.excar; 2 | 3 | public class Tesla extends Engine{ 4 | void drive(){ 5 | openCar(); 6 | start(); 7 | partGearBox(); 8 | stop(); 9 | } 10 | 11 | @Override 12 | void start() { 13 | System.out.println("Starting Tesla"); 14 | } 15 | 16 | @Override 17 | void stop() { 18 | System.out.println("Stopping Tesla"); 19 | 20 | } 21 | 22 | @Override 23 | void speed() { 24 | System.out.println("300km.hr"); 25 | 26 | } 27 | 28 | @Override 29 | void partGearBox() { 30 | System.out.println("electric"); 31 | 32 | } 33 | 34 | @Override 35 | void openCar() { 36 | System.out.println("open Tesla"); 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/excar/WagonR.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.excar; 2 | 3 | public class WagonR extends Engine{ 4 | 5 | void drive(){ 6 | openCar(); 7 | start(); 8 | partGearBox(); 9 | speed(); 10 | stop(); 11 | 12 | } 13 | 14 | @Override 15 | void start() { 16 | System.out.println("Starting Wagon R"); 17 | } 18 | 19 | @Override 20 | void stop() { 21 | System.out.println("Stop Wagon R"); 22 | 23 | } 24 | 25 | @Override 26 | void speed() { 27 | System.out.println("100KM/Hr"); 28 | } 29 | 30 | @Override 31 | void partGearBox() { 32 | System.out.println("Wagon/Hr"); 33 | 34 | } 35 | 36 | @Override 37 | void openCar() { 38 | System.out.println("open Keys"); 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/excar/i10.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.excar; 2 | 3 | public class i10 extends Car{ 4 | void drivei10(){ 5 | openCar(); 6 | start(); 7 | partGearBox(); 8 | stop(); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/aug/ex_11082024/staticKeywrod/Lab193.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.staticKeywrod; 2 | 3 | public class Lab193 { 4 | // Static 5 | // block 6 | // Data member 7 | // Function 8 | // Class 9 | 10 | public static void main(String[] args) { 11 | ATB a1 = new ATB("amit"); 12 | } 13 | } 14 | 15 | 16 | class ATB{ 17 | 18 | { 19 | System.out.println("IIB"); 20 | // What is the purpose? - 21 | // Here you can write code related to 22 | // start a webite or anything before starting the 23 | // web automation or api automation 24 | // 25 | System.out.println("Reading from CSV file"); 26 | } 27 | 28 | static { 29 | System.out.println("Load the class?, I will execute"); 30 | } 31 | 32 | 33 | 34 | private String name; 35 | private String phone; 36 | static String courseName = "ATB"; 37 | 38 | public String getName() { 39 | return name; 40 | } 41 | 42 | public void setName(String name) { 43 | this.name = name; 44 | } 45 | 46 | public ATB(String name) { 47 | this.name = name; 48 | } 49 | 50 | static void doAssignment(){ 51 | System.out.println("Do Assignment"); 52 | } 53 | 54 | static class A{ 55 | 56 | } 57 | } -------------------------------------------------------------------------------- /src/aug/ex_11082024/staticKeywrod/Lab194.java: -------------------------------------------------------------------------------- 1 | package aug.ex_11082024.staticKeywrod; 2 | 3 | public class Lab194 { 4 | } 5 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/APIConstants.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public enum APIConstants { 4 | BASE_URL("https://app.vwo.com"), 5 | LOGIN_PAGE("https://app.vwo.com/login"), 6 | DASHBOARD_PAGE("https://app.vwo.com/dasHboard"), 7 | CHATBOT_PAGE("https://app.vwo.com/chat"); 8 | 9 | 10 | private final String name; 11 | 12 | APIConstants(String name) { 13 | this.name = name; 14 | } 15 | 16 | public String getValue() { 17 | return name; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/BUG.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public enum BUG { 4 | LOW, 5 | MEDIUM, 6 | HIGH 7 | } 8 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/COLORS.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public enum COLORS { 4 | RED("#ff0000"), 5 | GREEN("#f0d0d0d"), 6 | BLUE("#f0d0d0d"); 7 | 8 | 9 | private final String hexValue; 10 | 11 | COLORS(String hexValue) { 12 | this.hexValue = hexValue; 13 | } 14 | 15 | public String getValue(){ 16 | return hexValue; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/Lab195.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | // Wrapper Classes 3 | 4 | public class Lab195 { 5 | public static void main(String[] args) { 6 | int a = 10; 7 | // Data Type -> int 8 | // primitive - data type 9 | System.out.println(a); 10 | 11 | 12 | // Java like everything should a Class or Object - OOPs 13 | Integer a1 = 10; 14 | 15 | 16 | 17 | 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/Lab196.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public class Lab196 { 4 | public static void main(String[] args) { 5 | // Primitive to Wrapper class 6 | int a = 10; 7 | Integer b = a; 8 | // Integer.MAX_VALUE 9 | System.out.println(a); 10 | System.out.println(b);// extra utilities are added. 11 | System.out.println(b);// extra utilities are added. 12 | 13 | 14 | 15 | 16 | // Wrapper class to Primitive 17 | Integer a2 = 42; // Auto Boxing - int -> Integer 18 | int value = a2; // UnBoxing - Integer -> int 19 | System.out.println(a2); 20 | System.out.println(value); 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/Lab197.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public class Lab197 { 4 | public static void main(String[] args) { 5 | String num = "10"; 6 | //int a = (int)num; 7 | Integer a = Integer.valueOf(num); 8 | System.out.println(a); 9 | 10 | // String to Primitive? 11 | int a2 = Integer.parseInt(num); 12 | System.out.println(a2); 13 | 14 | // String -> int, Integer 15 | // Primitive to Wrapper or reverse then you will use the concept. 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/Lab198.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public class Lab198 { 4 | public static void main(String[] args) { 5 | Double d = 3.14; // HEAP 6 | double val = d.doubleValue(); // CM 7 | System.out.println(d); 8 | System.out.println(val); 9 | 10 | String s1 = "pramod"; // SCP 11 | String s2 = new String("pramod"); // HEAP 12 | 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/Lab199.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public class Lab199 { 4 | public static void main(String[] args) { 5 | A a = new A(); 6 | A a2 = new A(); 7 | 8 | a.age = 12; 9 | System.out.println(A.discount); 10 | a.m2(); 11 | A.m1(); // Static 12 | 13 | // Static don't need object ref. - True 14 | 15 | } 16 | } 17 | 18 | 19 | 20 | class A{ 21 | int age = 10; // Instance variable 22 | static int discount = 199; // static variable 23 | 24 | // SIB - STATIC initialization block 25 | static { 26 | System.out.println("One Time Load SIB"); 27 | } 28 | 29 | // IIB - instance initialization block 30 | { 31 | System.out.println("IIB When Object is created"); 32 | } 33 | 34 | static void m1(){ 35 | System.out.println("m1"); 36 | } 37 | void m2(){ 38 | System.out.println("m2"); 39 | System.out.println(discount); 40 | } 41 | } -------------------------------------------------------------------------------- /src/aug/ex_17082024/Lab200.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public class Lab200 { 4 | public static void main(String[] args) { 5 | APIAutomation a = new APIAutomation(); 6 | // SIB - call 1 time 7 | // IIB - when object is created. 8 | } 9 | } 10 | 11 | class APIAutomation{ 12 | 13 | static { 14 | // write a code to load the data from the MySQL 15 | System.out.println("Loaded data from the MYSQL"); 16 | } 17 | 18 | { 19 | // write a code to load the data from the CSV file 20 | System.out.println("Loaded data from the CSV"); 21 | 22 | } 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/Lab201.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public class Lab201 { 4 | } 5 | 6 | // Nested Class - Rarely you will be using it 7 | 8 | class OC{ 9 | Integer a = 10; 10 | 11 | void OC_m1(){ 12 | // System.out.println(b); 13 | System.out.println("OC_M1"); 14 | } 15 | 16 | static class P{ 17 | 18 | } 19 | 20 | 21 | class InnerClass{ 22 | Integer b = 20; 23 | void Inner_m2(){ 24 | System.out.println(a); 25 | System.out.println("IC_M2"); 26 | 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/aug/ex_17082024/Lab202.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public class Lab202 { 4 | public static void main(String[] args) { 5 | Car c = new Car("Lambo"); 6 | c.drive(); 7 | // System.out.println(c.make); 8 | 9 | // to access the inner class Object creation. 10 | Car.GearBox cg = c.new GearBox(); 11 | cg.m2(); 12 | 13 | 14 | } 15 | } 16 | 17 | 18 | class Car { 19 | private String make; 20 | 21 | public Car(String make) { 22 | this.make = make; 23 | } 24 | 25 | // Method 26 | void drive() { 27 | System.out.println("You can driver Car"); 28 | } 29 | 30 | class GearBox { 31 | void m2() { 32 | System.out.println("m2"); 33 | } 34 | class NutBolts{ 35 | 36 | } 37 | 38 | } 39 | 40 | 41 | } -------------------------------------------------------------------------------- /src/aug/ex_17082024/Lab203.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public class Lab203 { 4 | public static void main(String[] args) { 5 | // Anonymous Class 6 | 7 | ABC a = new ABC() { 8 | @Override 9 | public void m1() { 10 | System.out.println("m1"); 11 | } 12 | 13 | @Override 14 | public void m2() { 15 | System.out.println("m2"); 16 | } 17 | }; 18 | 19 | CBA a1 = new CBA() { 20 | @Override 21 | void m3() { 22 | System.out.println("M3"); 23 | } 24 | }; 25 | 26 | } 27 | } 28 | 29 | 30 | interface ABC{ 31 | void m1(); 32 | void m2(); 33 | } 34 | 35 | abstract class CBA{ 36 | abstract void m3(); 37 | } 38 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/Lab205.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public class Lab205 { 4 | public static void main(String[] args) { 5 | System.out.println("BUG value -" + BUG.LOW); 6 | 7 | System.out.println("I am working on "+ PAGES.CHATBOTPAGE); 8 | 9 | 10 | System.out.println("Color Code "+ COLORS.RED); 11 | System.out.println("Color Code "+ COLORS.RED.getValue()); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/Lab206.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public class Lab206 { 4 | public static void main(String[] args) { 5 | System.out.println("Color Code "+ COLORS.RED); 6 | System.out.println("Color Value "+ COLORS.RED.getValue()); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/Lab208.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public class Lab208 { 4 | public static void main(String[] args) { 5 | System.out.println(APIConstants.LOGIN_PAGE); 6 | System.out.println(APIConstants.LOGIN_PAGE.getValue()); 7 | 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/Lab209.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public class Lab209 { 4 | public static void main(String[] args) { 5 | System.out.println("Start of the program"); 6 | 7 | String ip = args[0]; // ArrayIndexOutOfBoundsException 8 | int a = Integer.parseInt(ip); // NumberFormatException 9 | int b = 1000/a; // ArithmeticException 10 | System.out.println(b); 11 | System.out.println("End of the program"); 12 | 13 | //JVM will be Initialized 14 | //Creates and Starts the main Thread. - Main Called 15 | //1)Collects the Command Line Arguments 16 | //2)Creates the String array with CLI 17 | //3. Lab209.main(0) 18 | //Now Control will be transferred from main Thread to main method 19 | // When problem comes in main -> JVM 20 | // If don't handle the exception JVM - 21 | // Exception a=new Exception() and terminate the program. G 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/Lab210.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | import java.io.File; 4 | import java.io.FileInputStream; 5 | import java.io.FileNotFoundException; 6 | 7 | public class Lab210 { 8 | public static void main(String[] args) { 9 | // Exception 10 | // Checked - JVM knows - 11 | // try { 12 | // FileInputStream file = new FileInputStream("C://log.txt"); 13 | // } catch (FileNotFoundException e) { 14 | // throw new RuntimeException(e); 15 | // } 16 | 17 | 18 | // UnChecked 19 | try { 20 | int a = 10; 21 | int c = a/0; // java.lang.ArithmeticException 22 | System.out.println("c"); 23 | } catch (Exception e) { 24 | System.out.println("Error / by zero"); 25 | } 26 | 27 | System.out.println("End of program"); 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/Lab211.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public class Lab211 { 4 | public static void main(String[] args) { 5 | int c = 0; 6 | try { 7 | c = 10/0; 8 | } catch (Exception e) { 9 | System.out.println("/ by zero!!, You fool!!"); 10 | } 11 | System.out.println(c); 12 | System.out.println("End"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/Lab212.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public class Lab212 { 4 | public static void main(String[] args) { 5 | System.out.println("Start of the program"); 6 | 7 | int b = 0; // ArithmeticException 8 | try { 9 | String ip = args[0]; // ArrayIndexOutOfBoundsException 10 | int a = Integer.parseInt(ip); // NumberFormatException 11 | b = 1000/a; 12 | } catch (ArithmeticException| NumberFormatException | ArrayIndexOutOfBoundsException e) { 13 | System.out.println(e.getMessage()); 14 | } 15 | System.out.println(b); 16 | System.out.println("End of the program"); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/Lab213.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public class Lab213 { 4 | public static void main(String[] args) { 5 | System.out.println("Start of the program"); 6 | 7 | String ip = null; // ArrayIndexOutOfBoundsException 8 | try { 9 | ip = args[0]; 10 | } catch (ArrayIndexOutOfBoundsException e) { 11 | throw new RuntimeException(e); 12 | } 13 | int a = 0; // NumberFormatException 14 | try { 15 | a = Integer.parseInt(ip); 16 | } catch (NumberFormatException e) { 17 | throw new RuntimeException(e); 18 | } 19 | int b = 0; // ArithmeticException 20 | try { 21 | b = 1000 / a; 22 | } catch (ArithmeticException e) { 23 | throw new RuntimeException(e); 24 | } 25 | System.out.println(b); 26 | System.out.println("End of the program"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/Lab214.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public class Lab214 { 4 | public static void main(String[] args) { 5 | try { 6 | String s1 = "Pramod"; 7 | String a1 = args[0]; 8 | int a = 10 / 0; 9 | s1 = null; 10 | System.out.println(s1.trim()); 11 | } catch (Exception e) { 12 | System.out.println("There is some problem with the code"); 13 | System.out.println(e.getMessage()); 14 | } 15 | 16 | 17 | System.out.println("End of Program!"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/Lab215.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public class Lab215 { 4 | public static void main(String[] args) { 5 | final double pi = 3.14; 6 | int a= 0; 7 | try { 8 | int x = 10/a; 9 | } catch (Exception e) { 10 | System.out.println("div by Zero"); 11 | } finally { 12 | System.out.println("I will be executed anyHow!!"); 13 | } 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/Lab216.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public class Lab216 { 4 | public static void main(String[] amit) { 5 | 6 | try { 7 | int a = 10/0; 8 | } catch (Exception pramod) { 9 | System.out.println("Div by Zero"); 10 | //pramod.getMessage() 11 | } finally { 12 | System.out.println("I will be always Executed, anyHow!!"); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/Lab217.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | import java.io.File; 4 | import java.io.FileNotFoundException; 5 | import java.io.FileReader; 6 | 7 | public class Lab217 { 8 | public static void main(String[] args) { 9 | try { 10 | int a = 10/0; // Uncheck Ath E 11 | } catch (Exception e) { 12 | throw new RuntimeException(e); 13 | } 14 | 15 | try { 16 | FileReader f = new FileReader(new File("c://a.txt")); 17 | } catch (FileNotFoundException e) { 18 | throw new RuntimeException(e); 19 | } 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/aug/ex_17082024/PAGES.java: -------------------------------------------------------------------------------- 1 | package aug.ex_17082024; 2 | 3 | public enum PAGES { 4 | LOGINPAGE, 5 | DASHBOARDPAGE, 6 | SUPPORTPAGE, 7 | CHATBOTPAGE 8 | } 9 | -------------------------------------------------------------------------------- /src/aug/ex_18082024/Bank.java: -------------------------------------------------------------------------------- 1 | package aug.ex_18082024; 2 | 3 | public class Bank { 4 | private String currency; 5 | private Integer amount; 6 | 7 | public Bank(String currency, Integer amount) { 8 | this.currency = currency; 9 | this.amount = amount; 10 | } 11 | 12 | public String getCurrency() { 13 | return currency; 14 | } 15 | 16 | public void setCurrency(String currency) { 17 | this.currency = currency; 18 | } 19 | 20 | public Integer getAmount() { 21 | return amount; 22 | } 23 | 24 | public void setAmount(Integer amount) { 25 | this.amount = amount; 26 | } 27 | 28 | public Integer add(Bank bankName){ 29 | if(!bankName.currency.equalsIgnoreCase("INR")){ 30 | // throw exception that it is not supported - USD, gBP + INR 31 | try { 32 | throw new Exception("Currency Doesn't Match!"); 33 | } catch (Exception e) { 34 | throw new RuntimeException(e); 35 | } 36 | 37 | } 38 | Integer sum = this.amount + bankName.amount; 39 | return sum; 40 | } 41 | 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/aug/ex_18082024/CollectionFramework/Lab227.java: -------------------------------------------------------------------------------- 1 | package aug.ex_18082024.CollectionFramework; 2 | 3 | public class Lab227 { 4 | public static void main(String[] args) { 5 | // Collection Framework 6 | 7 | 8 | // Array 9 | Integer [] arr = new Integer[10]; 10 | int[] arr2 = new int[10]; 11 | 12 | arr[0] = 11; 13 | 14 | // Size -> Fixed Size Problem in array. 15 | // // Can I increase the size of the array? 16 | // arr2.sort() 17 | // find something the array? 18 | // There are not in built functions available in the arrays 19 | // sorting, updating, delete, increasing size, decrease size. 20 | // appending, finding ... 21 | // array can store one type of data type 22 | 23 | 24 | // ArrayList -> this has solved all the problem 25 | 26 | 27 | // JDK 1.2 - 1997 28 | // Legacy Classes 29 | // Vector 30 | // Stack 31 | // Properties 32 | // Hash table 33 | // Dictionary 34 | 35 | 36 | // JDK 22 - Advance Collection Class that we can use. 37 | 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/aug/ex_18082024/CollectionFramework/Lab228.java: -------------------------------------------------------------------------------- 1 | package aug.ex_18082024.CollectionFramework; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collection; 5 | import java.util.List; 6 | 7 | public class Lab228 { 8 | public static void main(String[] args) { 9 | // Collections Framework 10 | // Collection - Interface 11 | // Collection(I) -> List (I) 12 | // List (I) -> ArrayList, LinkedList, Vector, Stack 13 | 14 | // Shopping List, Marks List, Collection of items, Todo List, Student List. 15 | // Collection mylist3 = new ArrayList(); // Dynamic Dispatch 16 | // List mylist = new ArrayList(); // Dynamic Dispatch 17 | // 18 | ArrayList mylist2 = new ArrayList(); 19 | mylist2.add("Pramod"); 20 | mylist2.add("Amit"); 21 | mylist2.add("lucky"); 22 | mylist2.add("Muthu"); 23 | mylist2.add(123); 24 | mylist2.add(true); 25 | 26 | System.out.println(mylist2); // [Pramod, Amit, lucky, Muthu] 27 | System.out.println(mylist2.size()); // 4 28 | System.out.println(mylist2.contains("Amit")); // true 29 | System.out.println(mylist2.contains("Hemalata")); // false 30 | String s1 = (String) mylist2.get(1); 31 | System.out.println(s1); 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/aug/ex_18082024/CollectionFramework/Lab229.java: -------------------------------------------------------------------------------- 1 | package aug.ex_18082024.CollectionFramework; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class Lab229 { 7 | public static void main(String[] args) { 8 | int [] a = new int[5]; 9 | a[0] = 1; 10 | a[1] = 2; 11 | a[2] = 3; 12 | a[3] = 4; 13 | a[4] = 5; 14 | 15 | for (int i = 0; i < a.length ; i++) { 16 | if( a[i] == 4){ 17 | System.out.println("Found 4"); 18 | } 19 | } 20 | 21 | ArrayList arr = new ArrayList(); 22 | arr.add(1); 23 | arr.add(2); 24 | arr.add(3); 25 | arr.add(4); 26 | arr.add(5); 27 | System.out.println(arr.contains(4)); 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/aug/ex_18082024/CollectionFramework/Lab230.java: -------------------------------------------------------------------------------- 1 | package aug.ex_18082024.CollectionFramework; 2 | 3 | import java.util.List; 4 | 5 | public class Lab230 { 6 | public static void main(String[] args) { 7 | List shopping_list = List.of("Milk","Bread","Butter","Cheese"); 8 | System.out.println(shopping_list); 9 | System.out.println(shopping_list.size()); 10 | shopping_list.add("Banana"); 11 | 12 | 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/aug/ex_18082024/CollectionFramework/Lab231.java: -------------------------------------------------------------------------------- 1 | package aug.ex_18082024.CollectionFramework; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class Lab231 { 7 | public static void main(String[] args) { 8 | List mylist = new ArrayList(); 9 | mylist.add("Pramod"); 10 | mylist.add("Anusha"); 11 | mylist.add("Kiran"); 12 | mylist.add("Pramod"); // Duplicate 13 | mylist.add("Pramod"); 14 | // add, remove, clear, contains, indexOf, isEmpty, size, get 15 | // addAll, removeAll, retainAll, containsAll 16 | System.out.println(mylist); 17 | System.out.println(mylist.size()); 18 | mylist.remove("Pramod"); 19 | // Removes the first occurrence of the specified element from this list, 20 | System.out.println(mylist); 21 | mylist.clear(); 22 | System.out.println(mylist); 23 | System.out.println(mylist.isEmpty()); 24 | 25 | mylist.add("Pramod"); 26 | mylist.add("Anusha"); 27 | mylist.add("Kiran"); 28 | mylist.add("Pramod"); // Duplicate 29 | mylist.add("Pramod"); 30 | 31 | System.out.println(mylist); 32 | mylist.add("Dutta"); 33 | System.out.println(mylist); 34 | mylist.set(1, "AnushaDutta"); 35 | System.out.println(mylist); 36 | 37 | mylist.add(123); 38 | mylist.add(true); 39 | System.out.println(mylist); 40 | 41 | System.out.println(" - - - -- " ); 42 | 43 | // hOw to print? 44 | for (int i = 0; i < mylist.size(); i++) { 45 | System.out.println(mylist.get(i)); 46 | } 47 | 48 | System.out.println(" - - - -- " ); 49 | 50 | 51 | // Enhanced For loop 52 | for (Object o: mylist){ 53 | System.out.println(o); 54 | } 55 | 56 | 57 | 58 | 59 | 60 | 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/aug/ex_18082024/CollectionFramework/Lab232.java: -------------------------------------------------------------------------------- 1 | package aug.ex_18082024.CollectionFramework; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.Comparator; 6 | import java.util.List; 7 | 8 | public class Lab232 { 9 | public static void main(String[] args) { 10 | List marks = new ArrayList(); 11 | marks.add(91); 12 | marks.add(95); 13 | marks.add(56); 14 | marks.add(89); 15 | System.out.println(marks); 16 | // Collections.sort(marks); 17 | Collections.sort(marks, Comparator.reverseOrder()); 18 | System.out.println(marks); 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/aug/ex_18082024/CollectionFramework/Lab233.java: -------------------------------------------------------------------------------- 1 | package aug.ex_18082024.CollectionFramework; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.List; 6 | 7 | public class Lab233 { 8 | public static void main(String[] args) { 9 | List marks = new ArrayList(); 10 | marks.add(100); 11 | // marks.add("pramod"); 12 | // marks.add(true); 13 | // Collection -I 14 | // Collections -C 15 | 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/aug/ex_18082024/CollectionFramework/Lab234.java: -------------------------------------------------------------------------------- 1 | package aug.ex_18082024.CollectionFramework; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | public class Lab234 { 8 | public static void main(String[] args) { 9 | List mylist = new ArrayList(); 10 | mylist.add("Pramod"); 11 | mylist.add("Amit"); 12 | mylist.add("Dutta"); 13 | 14 | System.out.println(" - To Print Arraylist - 1 "); 15 | 16 | for (String str : mylist) { 17 | System.out.println(str); 18 | } 19 | 20 | System.out.println(" - To Print Arraylist - 2 "); 21 | 22 | for (int i = 0; i < mylist.size(); i++) { 23 | System.out.println(mylist.get(i)); 24 | } 25 | 26 | System.out.println(" - To Print Arraylist - 3 "); 27 | 28 | // Iterator 29 | Iterator its = mylist.iterator(); 30 | while(its.hasNext()){ 31 | System.out.println(its.next()); 32 | } 33 | 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/aug/ex_18082024/CollectionFramework/Lab235.java: -------------------------------------------------------------------------------- 1 | package aug.ex_18082024.CollectionFramework; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Vector; 6 | 7 | public class Lab235 { 8 | public static void main(String[] args) { 9 | List mylist1 = new ArrayList(5); // FR - CO 10 | mylist1.add("Pramod"); 11 | mylist1.add("Anusha"); 12 | mylist1.add("Kiran"); 13 | mylist1.add("Kiran"); 14 | mylist1.add("Kiran"); 15 | mylist1.add("Kiran"); 16 | System.out.println(mylist1); 17 | 18 | Vector v = new Vector(); 19 | v.add("Pramod"); // t1 20 | v.add("Anusha"); // t1 21 | v.add("Kiran"); // t1 22 | System.out.println(v); 23 | // Only Problem with the Vector 24 | // - It is Thread Safe, Synchronised. 25 | // It will be time consumming 26 | // One by One - usage 27 | // Slower 28 | 29 | 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/aug/ex_18082024/Lab218.java: -------------------------------------------------------------------------------- 1 | package aug.ex_18082024; 2 | 3 | public class Lab218 { 4 | 5 | public static void main(String[] args) { 6 | extracted(); 7 | } 8 | 9 | private static void extracted() { 10 | extracted1(); 11 | } 12 | 13 | private static void extracted1() { 14 | try { 15 | Integer[] i = new Integer[2]; 16 | System.out.println(i[3]); // Unchecked - ArrayIndexOutOfBoundsException 17 | } catch (Exception e) { 18 | System.out.println("ArrayIndexOutofBound"); 19 | }finally { 20 | // File.close, sc.close, sqlconnection.close. 21 | System.out.println("End of the program"); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/aug/ex_18082024/Lab219.java: -------------------------------------------------------------------------------- 1 | package aug.ex_18082024; 2 | 3 | import java.io.File; 4 | import java.io.FileReader; 5 | 6 | public class Lab219 { 7 | public static void main(String[] args) { 8 | String path = "C://a.txt"; 9 | File file = new File(path); 10 | try { 11 | FileReader fileReader = new FileReader(file); 12 | } catch (Exception e) { 13 | System.out.println("FNE"); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/aug/ex_18082024/Lab220.java: -------------------------------------------------------------------------------- 1 | package aug.ex_18082024; 2 | 3 | import java.io.File; 4 | import java.io.FileNotFoundException; 5 | import java.io.FileReader; 6 | 7 | public class Lab220 { 8 | public static void main(String[] args) throws FileNotFoundException ,ArithmeticException { 9 | readFile(); 10 | } 11 | 12 | private static void readFile() throws FileNotFoundException,ArithmeticException { 13 | System.out.println("Hello Pramod"); 14 | String path = "/Users/promode/Downloads/Ad1.mp4"; 15 | File file = new File(path); 16 | FileReader fileReader = new FileReader(file); 17 | 18 | // read the file txt it can read the file 19 | System.out.println("End of the program"); 20 | 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/aug/ex_18082024/Lab221.java: -------------------------------------------------------------------------------- 1 | package aug.ex_18082024; 2 | 3 | import java.io.File; 4 | import java.io.FileNotFoundException; 5 | import java.io.FileReader; 6 | 7 | public class Lab221 { 8 | public static void main(String[] args) throws FileNotFoundException { 9 | try { 10 | int a = 10 / 0; // un - ar 11 | } catch (ArithmeticException | NullPointerException | ArrayIndexOutOfBoundsException e) { 12 | System.out.println("e1"); 13 | 14 | }catch (Exception e2){ 15 | System.out.println("e2"); 16 | }finally { 17 | System.out.println("FF"); 18 | } 19 | 20 | FileReader f = new FileReader(new File("/Users/promode/Downloads/Ad1.mp4")); 21 | 22 | 23 | } 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/aug/ex_18082024/Lab222.java: -------------------------------------------------------------------------------- 1 | package aug.ex_18082024; 2 | 3 | public class Lab222 { 4 | public static void main(String[] args) throws Exception { 5 | // throw 6 | // Custom Exception 7 | Bank sbi = new Bank("INR", 100); 8 | // Bank icici = new Bank("INR", 10); 9 | // Integer total = sbi.add(icici); 10 | // System.out.println(total); 11 | 12 | Bank jpmorgan = new Bank("AED", 89); 13 | Integer totalnew = sbi.add(jpmorgan); 14 | System.out.println(totalnew); 15 | 16 | } 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/aug/ex_18082024/Lab223.java: -------------------------------------------------------------------------------- 1 | package aug.ex_18082024; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Lab223 { 6 | public static void main(String[] args) { 7 | Scanner sc = new Scanner(System.in); 8 | System.out.println("Enter your name"); 9 | String name = sc.next(); 10 | if (name.equalsIgnoreCase("Pramod")){ 11 | try { 12 | throw new Exception("Not allowed!!"); 13 | } catch (Exception e) { 14 | System.out.println("Exception!!"); 15 | } 16 | }else { 17 | System.out.println("Allowed!"); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/aug/ex_18082024/Lab224.java: -------------------------------------------------------------------------------- 1 | package aug.ex_18082024; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Lab224 { 6 | public static void main(String[] args) { 7 | Scanner sc = new Scanner(System.in); 8 | int x = sc.nextInt(); 9 | try { 10 | if( x == 0){ 11 | throw new ArithmeticException("Enter non zero number"); 12 | } 13 | int a = 10/x; 14 | System.out.println(a); 15 | } catch (ArithmeticException e) { 16 | throw new RuntimeException(e); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/aug/ex_18082024/Lab225.java: -------------------------------------------------------------------------------- 1 | package aug.ex_18082024; 2 | 3 | public class Lab225 { 4 | public static void main(String[] args) { 5 | try { 6 | String s1 = null; 7 | if (s1 == null){ 8 | throw new Exception("Add a proper String or not null String"); 9 | } 10 | s1.trim(); 11 | } catch (Exception e) { 12 | throw new RuntimeException(e); 13 | } 14 | // 15 | 16 | 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/aug/ex_18082024/Lab226.java: -------------------------------------------------------------------------------- 1 | package aug.ex_18082024; 2 | 3 | public class Lab226 extends Object { 4 | public static void main(String[] args) { 5 | String name = "Dramod"; // pramod 6 | String name2 = "pramod"; // pramod 7 | if (name.equalsIgnoreCase(name2)){ 8 | System.out.println("Equal"); 9 | }else { 10 | System.out.println("Not EQUAL"); 11 | } 12 | 13 | // final -> constant 14 | // finally -> block of code with the try and catch 15 | // finalize -> Object class function - threading use case 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/aug/ex_24082024/Lab236.java: -------------------------------------------------------------------------------- 1 | package aug.ex_24082024; 2 | 3 | import java.util.ArrayList; 4 | import java.util.LinkedList; 5 | 6 | public class Lab236 extends Object { 7 | public static void main(String[] args) { 8 | LinkedList l = new LinkedList(); 9 | l.add("Node 1"); 10 | l.add("Node 2"); 11 | l.add("Node 3"); 12 | System.out.println(l); 13 | 14 | 15 | ArrayList l2 = new ArrayList(); 16 | l2.add("Node 1"); 17 | l2.add("Node 2"); 18 | l2.add("Node 3"); 19 | System.out.println(l2); 20 | 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/aug/ex_24082024/Lab237.java: -------------------------------------------------------------------------------- 1 | package aug.ex_24082024; 2 | 3 | import java.util.ArrayList; 4 | import java.util.LinkedList; 5 | import java.util.Stack; 6 | 7 | public class Lab237 { 8 | public static void main(String[] args) { 9 | // Vector, Stack - Legacy - 95% of time we are not going to use it in automation 10 | // legacy? - old -> 11 | 12 | Stack s = new Stack(); 13 | s.push("Pramod"); 14 | s.push("Dutta"); 15 | s.push("Amit"); 16 | s.add("Amit2"); 17 | System.out.println(s); 18 | System.out.println(s.peek()); 19 | System.out.println(s.pop()); 20 | 21 | System.out.println(s); 22 | 23 | 24 | 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/aug/ex_24082024/Lab238.java: -------------------------------------------------------------------------------- 1 | package aug.ex_24082024; 2 | 3 | import java.util.*; 4 | 5 | public class Lab238 { 6 | public static void main(String[] args) { 7 | // Student - name, id 8 | Student s1 = new Student(4, "Supriya"); 9 | Student s2 = new Student(2, "Thaku Amit Singh"); 10 | Student s3 = new Student(3, "Muthu"); 11 | Student s4 = new Student(1, "Darshan"); 12 | 13 | List arrayList = new ArrayList(); 14 | arrayList.add(s1); 15 | arrayList.add(s2); 16 | arrayList.add(s3); 17 | arrayList.add(s4); 18 | System.out.println(arrayList); 19 | // Collections.sort(arrayList); // Comparable 20 | // Collections.sort(arrayList, new SortByID()); 21 | // Collections.sort(arrayList, new SortByName()); 22 | // Collections.sort(arrayList, new SortByIDDesc()); 23 | Collections.sort(arrayList, new SortByNameDesc()); 24 | System.out.println(arrayList); 25 | 26 | 27 | } 28 | } 29 | 30 | class SortByName implements Comparator { 31 | @Override 32 | public int compare(Student o1, Student o2) { 33 | return o1.getName().compareTo(o2.getName()); 34 | } 35 | } 36 | 37 | class SortByNameDesc implements Comparator { 38 | @Override 39 | public int compare(Student o1, Student o2) { 40 | return o2.getName().compareTo(o1.getName()); 41 | } 42 | } 43 | 44 | class SortByID implements Comparator { 45 | @Override 46 | public int compare(Student o1, Student o2) { 47 | return Integer.compare(o1.getId(), o2.getId()); 48 | } 49 | } 50 | 51 | class SortByIDDesc implements Comparator { 52 | @Override 53 | public int compare(Student o1, Student o2) { 54 | return Integer.compare(o2.getId(), o1.getId()); 55 | } 56 | } 57 | 58 | 59 | //class Student implements Comparable { 60 | class Student { 61 | private Integer id; 62 | private String name; 63 | 64 | public Student(Integer id, String name) { 65 | this.id = id; 66 | this.name = name; 67 | } 68 | 69 | public Integer getId() { 70 | return id; 71 | } 72 | 73 | public void setId(Integer id) { 74 | this.id = id; 75 | } 76 | 77 | public String getName() { 78 | return name; 79 | } 80 | 81 | public void setName(String name) { 82 | this.name = name; 83 | } 84 | 85 | @Override 86 | public String toString() { 87 | return "Student{" + 88 | "id=" + id + 89 | ", name='" + name + '\'' + 90 | '}'; 91 | } 92 | 93 | 94 | // @Override 95 | // public int compareTo(Student another) { 96 | // return Integer.compare(this.id, another.id); 97 | // } 98 | // 99 | // @Override 100 | // public int compareTo(Student another) { 101 | // return CharSequence.compare(this.name, another.name); 102 | // } 103 | } 104 | -------------------------------------------------------------------------------- /src/aug/ex_24082024/Lab239.java: -------------------------------------------------------------------------------- 1 | package aug.ex_24082024; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.LinkedList; 6 | import java.util.List; 7 | 8 | public class Lab239 { 9 | public static void main(String[] args) { 10 | ArrayList marks = new ArrayList(); 11 | marks.add(14); 12 | marks.add(98); 13 | marks.add(10); 14 | marks.add(99); 15 | Collections.sort(marks); // Natural Sorting 16 | System.out.println(marks); 17 | 18 | ArrayList names = new ArrayList(); 19 | names.add("Pramod"); 20 | names.add("Amit"); 21 | names.add("Dutta"); 22 | names.add("Lukcy"); 23 | Collections.sort(names); // A,D,L,P // Natural Sorting First Alpha 24 | System.out.println(names); 25 | 26 | 27 | 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/aug/ex_24082024/Lab240.java: -------------------------------------------------------------------------------- 1 | package aug.ex_24082024; 2 | 3 | public class Lab240 { 4 | public static void main(String[] args) { 5 | Person p1 = new Person("Pramod","KA"); 6 | Person p2 = new Person("Lucky","New Delhi"); 7 | System.out.println(p1); 8 | System.out.println(p2); 9 | } 10 | } 11 | 12 | class Person extends Object{ 13 | String name; 14 | String address; 15 | 16 | public Person(String name, String address) { 17 | this.name = name; 18 | this.address = address; 19 | } 20 | 21 | @Override 22 | public String toString() { 23 | return "ID ->" + name + " , Address -> " + address; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/aug/ex_24082024/Lab241.java: -------------------------------------------------------------------------------- 1 | package aug.ex_24082024; 2 | 3 | import java.util.HashSet; 4 | import java.util.LinkedHashSet; 5 | import java.util.Set; 6 | import java.util.TreeSet; 7 | 8 | public class Lab241 { 9 | public static void main(String[] args) { 10 | // List - > Duplicate Allows 11 | // Set -> Doesn't allow Duplicate 12 | Set hd = new HashSet(); 13 | Set lhs = new LinkedHashSet(); 14 | Set ts = new TreeSet(); 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/aug/ex_24082024/Lab242.java: -------------------------------------------------------------------------------- 1 | package aug.ex_24082024; 2 | 3 | import java.util.*; 4 | 5 | public class Lab242 { 6 | public static void main(String[] args) { 7 | // List - > Duplicate Allows 8 | // Set -> Doesn't allow Duplicate 9 | Set hs = new HashSet(); // Hashing mechanism to store the element, no order 10 | hs.add("Apple"); 11 | hs.add("Orange"); 12 | hs.add("WaterMelon"); 13 | hs.add("WaterMelon"); 14 | hs.add(null); 15 | System.out.println(hs); 16 | 17 | Set lhs = new LinkedHashSet(); // LinkedList mechanism to store the element, order will maintain 18 | lhs.add("Apple"); 19 | lhs.add("apple"); 20 | lhs.add("Orange"); 21 | lhs.add("WaterMelon"); 22 | lhs.add(null); 23 | System.out.println(lhs); 24 | System.out.println(lhs.isEmpty()); 25 | System.out.println(lhs.contains("Apple")); 26 | System.out.println(lhs.size()); 27 | 28 | 29 | Set ts = new TreeSet(); // Black and Red Tree mechanism to store the element, order will maintain 30 | ts.add("Dapple"); 31 | ts.add("Apple"); 32 | ts.add("Orange"); 33 | ts.add("Orange"); 34 | ts.add("WaterMelon"); 35 | // ts.add(null); # Can we sorting with null? 36 | System.out.println(ts); 37 | 38 | 39 | for (Object s : ts) { 40 | System.out.println(s); 41 | } 42 | 43 | Iterator it = ts.iterator(); 44 | while (it.hasNext()) { 45 | System.out.println(it.next()); 46 | } 47 | 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/aug/ex_24082024/Lab243.java: -------------------------------------------------------------------------------- 1 | package aug.ex_24082024; 2 | 3 | import java.util.PriorityQueue; 4 | 5 | public class Lab243 { 6 | public static void main(String[] args) { 7 | // Queue - < 1% in Automation 8 | // 9 | PriorityQueue pq= new PriorityQueue(); 10 | pq.offer("1"); // add 11 | pq.offer("3"); 12 | pq.offer("2"); 13 | pq.offer("4"); 14 | System.out.println(pq); 15 | System.out.println(pq.peek()); 16 | System.out.println(pq.poll()); 17 | System.out.println(pq); 18 | 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/aug/ex_24082024/Lab244.java: -------------------------------------------------------------------------------- 1 | package aug.ex_24082024; 2 | //Iterator later 3 | 4 | import java.util.*; 5 | 6 | public class Lab244 { 7 | public static void main(String[] args) { 8 | // Map - key and value pair 9 | // name:pramod, roll:31, phone:9876543210 10 | Map m1 = new HashMap(); 11 | // Map m1 = new LinkedHashMap(); 12 | // Map m1 = new TreeMap(); 13 | m1.put("name","pramod"); 14 | m1.put("rollNo",123); 15 | m1.put("phone",98765432); 16 | System.out.println(m1); 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/aug/ex_24082024/Lab245.java: -------------------------------------------------------------------------------- 1 | package aug.ex_24082024; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class Lab245 { 7 | public static void main(String[] args) { 8 | Map map = new HashMap(); 9 | map.put("id",1); 10 | map.put("id2",2); 11 | map.put("id3",34); 12 | map.put("id4",null); 13 | map.put("id5",null); 14 | // map.put(null,100); 15 | map.put(null,101); 16 | // map.put("id5","pramod"); 17 | System.out.println(map); 18 | System.out.println(map.size()); 19 | System.out.println(map.isEmpty()); 20 | System.out.println(map.containsKey("id2")); 21 | System.out.println(map.containsValue(34)); 22 | System.out.println(map.containsValue(99)); 23 | System.out.println(map.keySet()); 24 | System.out.println(map.values()); 25 | System.out.println(map.get("id3")); 26 | 27 | System.out.println(" --- "); 28 | 29 | // How to iterate over all the elements in the map 30 | for(Map.Entry item: map.entrySet()){ 31 | System.out.println(item.getKey() + " -> "+ item.getValue()); 32 | } 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/aug/ex_24082024/Lab246.java: -------------------------------------------------------------------------------- 1 | package aug.ex_24082024; 2 | 3 | import java.util.*; 4 | 5 | public class Lab246 { 6 | public static void main(String[] args) { 7 | Hashtable ht1 = new Hashtable<>(); 8 | // Map 9 | // null 10 | // Synchronised 11 | // Slow 12 | // Legacy Class 13 | 14 | ht1.put(1, "one"); 15 | ht1.put(2, "two"); 16 | ht1.put(3, "three"); 17 | 18 | 19 | // 20 | Enumeration e = ht1.keys(); 21 | while (e.hasMoreElements()){ 22 | System.out.println(ht1.get(e.nextElement())); 23 | } 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/aug/ex_24082024/Lab247.java: -------------------------------------------------------------------------------- 1 | package aug.ex_24082024; 2 | 3 | import java.util.HashMap; 4 | import java.util.Hashtable; 5 | import java.util.Set; 6 | 7 | public class Lab247 { 8 | public static void main(String[] args) { 9 | 10 | //// Hashtable ht1 = new Hashtable<>(); 11 | //// ht1.put(1, "one"); 12 | //// ht1.put(null, "one"); // java.lang.NullPointerException 13 | //// //ht1.put("one", "one"); 14 | // 15 | // HashMap h1 = new HashMap(); 16 | // h1.put(null,"dasda"); 17 | 18 | // Set fruits = new HashSet(); 19 | // fruits.add("Apple"); 20 | // fruits.add("Orange"); 21 | // fruits.add("apple"); 22 | // fruits.add("Water Melon"); 23 | //// fruits.add(123); 24 | 25 | 26 | 27 | 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/aug/ex_24082024/Lab248.java: -------------------------------------------------------------------------------- 1 | package aug.ex_24082024; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class Lab248 { 7 | public static void main(String[] args) { 8 | // Generic - < 2%, very rare concept, rarly used also 9 | List mylist = new ArrayList(); 10 | mylist.add("Pramod"); 11 | mylist.add(123); 12 | mylist.add(true); 13 | 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/aug/ex_24082024/Lab249.java: -------------------------------------------------------------------------------- 1 | package aug.ex_24082024; 2 | 3 | import static aug.ex_24082024.Lab249.sum; 4 | 5 | public class Lab249 { 6 | public static void main(String[] args) { 7 | 8 | temp("Pramod"); 9 | temp(123); 10 | temp(true); 11 | 12 | sum(3,4); 13 | sum("pramod","dutta"); 14 | 15 | // T - Ref to the Data Type that you want to use. 16 | 17 | } 18 | 19 | public static pramod sum(pramod a, pramod b){ 20 | System.out.println(a); 21 | System.out.println(b); 22 | return null; 23 | } 24 | 25 | public static void temp(Dutta name) { 26 | System.out.println(name); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/july/ex_07072024/$Lab010.java: -------------------------------------------------------------------------------- 1 | package july.ex_07072024; 2 | 3 | public class $Lab010 { 4 | } 5 | -------------------------------------------------------------------------------- /src/july/ex_07072024/Lab001.java: -------------------------------------------------------------------------------- 1 | package july.ex_07072024; 2 | 3 | public class Lab001 { 4 | public static void main(String[] args) { 5 | System.out.println("Hello World!"); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/july/ex_07072024/Lab002.java: -------------------------------------------------------------------------------- 1 | package july.ex_07072024; 2 | 3 | public class Lab002 { 4 | public static void main(String[] args) { 5 | System.out.println("Hello World Pramod!!"); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/july/ex_07072024/Lab003.java: -------------------------------------------------------------------------------- 1 | package july.ex_07072024; 2 | 3 | public class Lab003 { 4 | 5 | 6 | public static void main(String[] args) { 7 | // Single Comment - This code will not run or executed 8 | // 2+2 ? 9 | 10 | // Purpose Comment ? 11 | // Instructions to Jr QA or Dev 12 | // explain 13 | 14 | /** 15 | * Multiple Comment 16 | * Documentation Purpose 17 | * 18 | * 19 | * 20 | */ 21 | 22 | 23 | 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/july/ex_07072024/Lab004.java: -------------------------------------------------------------------------------- 1 | package july.ex_07072024; 2 | 3 | public class Lab004 { 4 | public static void main(String[] args) { 5 | 6 | // Package -> Class -> Main Method -> statements(instructions) 7 | System.out.println(2+2); 8 | System.out.println(2*2); 9 | System.out.println(2/2); 10 | System.out.println(2-2); 11 | System.out.println(3/2); // Integer 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/july/ex_07072024/Lab005.java: -------------------------------------------------------------------------------- 1 | package july.ex_07072024; 2 | 3 | public class Lab005 { 4 | public static void main(String[] args) { 5 | System.out.println(2+2); 6 | System.out.println(2-2); 7 | System.out.println(2/2); 8 | System.out.println(10/0); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/july/ex_07072024/Lab006.java: -------------------------------------------------------------------------------- 1 | package july.ex_07072024; 2 | 3 | public class Lab006 { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/july/ex_07072024/Lab007.java: -------------------------------------------------------------------------------- 1 | package july.ex_07072024; 2 | 3 | public class Lab007 { 4 | public static void main(String[] pramod) { 5 | System.out.println("Lab007"); 6 | System.out.println("Lab008"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/july/ex_07072024/Lab008.java: -------------------------------------------------------------------------------- 1 | package july.ex_07072024; 2 | 3 | public class Lab008 { 4 | // 5 | // Keywords and Identifier 6 | 7 | 8 | 9 | 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/july/ex_07072024/Lab011.java: -------------------------------------------------------------------------------- 1 | package july.ex_07072024; 2 | 3 | public class Lab011 { 4 | public static void main(String[] args) { 5 | System.out.println("Hello World"); 6 | System.out.println("Hello World"); 7 | 8 | System.out.print("Hello World"); 9 | System.out.print("Hello World"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/july/ex_07072024/Lab012.java: -------------------------------------------------------------------------------- 1 | package july.ex_07072024; 2 | 3 | public class Lab012 { 4 | public static void main(String[] abc) { 5 | System.out.println("Interview Q"); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/july/ex_07072024/Lab013.java: -------------------------------------------------------------------------------- 1 | package july.ex_07072024; 2 | 3 | public class Lab013 { 4 | // Can I run class without a main method? 5 | // run option? 6 | static public void main(String[] args) { 7 | 8 | } 9 | public static void main() { 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/july/ex_07072024/Lab014.java: -------------------------------------------------------------------------------- 1 | package july.ex_07072024; 2 | 3 | public class Lab014 { 4 | //public static void main(String[] args) { 5 | public static void main(String args[]) { 6 | System.out.println("Yes"); 7 | } 8 | 9 | public static void main(String args) { 10 | 11 | } 12 | public static void main(int[] args) { 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/july/ex_07072024/Pramod123.java: -------------------------------------------------------------------------------- 1 | package july.ex_07072024; 2 | 3 | public class Pramod123 { 4 | } 5 | -------------------------------------------------------------------------------- /src/july/ex_07072024/Pramod_Dutta.java: -------------------------------------------------------------------------------- 1 | package july.ex_07072024; 2 | 3 | public class Pramod_Dutta { 4 | } 5 | -------------------------------------------------------------------------------- /src/july/ex_07072024/_Lab009.java: -------------------------------------------------------------------------------- 1 | package july.ex_07072024; 2 | 3 | public class _Lab009 { 4 | } 5 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab015.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab015 { 4 | public static void main(String[] args) { 5 | 6 | // data_type variable_name = variable_value(literal) 7 | 8 | // Data Type 9 | // Primitive Data Type 10 | // boolean 11 | // true or false 12 | boolean is_married = true; 13 | boolean are_you_a_dog = false; 14 | System.out.println(is_married); 15 | System.out.println(are_you_a_dog); 16 | 17 | 18 | // Numerical 19 | // integral - byte, short, int, long 20 | 21 | byte b = 100; 22 | short s = 101; 23 | int age = 130; 24 | long phone_number = 9876543210L; // 9876543210l; 25 | 26 | // char - char - A,B 27 | char grade = 'A'; // O,A,B,C,D,E, F = Fail 28 | 29 | // floating 30 | // float 31 | float pi = 3.14f; // 3.14F; 32 | // double 33 | double d = 118.654; 34 | 35 | 36 | // Non primitive Data Types 37 | // String name -> "pramod" -, number or char or bunch of char 38 | String name = "Pramod"; 39 | String name2 = "p"; 40 | // char cc = "c"; 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab016.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab016 { 4 | public static void main(String[] args) { 5 | byte b = 10; 6 | System.out.println(b); 7 | // JVM -> brother who will execute the main method 8 | // 10 - Decimal 9 | // Machine(0,1) -> 00001010 - 8 bits = 1 Byte 10 | long distance_moon_earth = 3844000000000000l; 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab017.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab017 { 4 | public static void main(String[] args) { 5 | // age? 6 | 7 | //max age of theperson in world ? - 8 | byte age= 122; // age > 127 // less memory -> smart container - good practice 9 | int age1 = 100; // wasting memory - 214768348488 10 | 11 | // program store pi with only 2 decimal 3.14, 3.142323237866999 12 | float pi = 3.14f; 13 | double pi_d = 3.14876545678; 14 | 15 | // 16 | // byte - data type 17 | // Byte -> memory allocation 18 | // // curse electronice 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab018.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab018 { 4 | public static void main(String[] args) { 5 | //byte b = 128; //-127 to 127 6 | 7 | char c = 'A'; 8 | System.out.println(c); 9 | 10 | char c1 = '$'; 11 | System.out.println(c1); 12 | 13 | char c2 = '\n'; 14 | System.out.println(c2); 15 | 16 | char c3 = '\u1F6A'; //:) 17 | System.out.println(c3); 18 | // :), :(, :D .;) -> unicode chars 19 | 20 | 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab019.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab019 { 4 | } 5 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab020.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab020 { 4 | public static void main(String[] args) { 5 | byte b = 127; 6 | //b = b+1; 7 | System.out.println(b); 8 | 9 | char grade = 'A'; 10 | char grade_kusum = 'E'; 11 | char grade_wswati = 'B'; 12 | char c = '!'; 13 | char c2 = '@'; 14 | char _123 = 'N'; 15 | 16 | // Can I change the data type of variable between program 17 | // No 18 | int age = 123; 19 | 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab021.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab021 { 4 | public static void main(String[] args) { 5 | int A123 = 987; 6 | System.out.println(A123); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab022.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab022 { 4 | public static void main(String[] args) { 5 | System.out.println("9x1=9"); 6 | System.out.println("9x2=18"); 7 | System.out.println("9x10=90"); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab023.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab023 { 4 | public static void main(String[] args) { 5 | // Formatting 6 | int age = 98; 7 | System.out.println("You age is -> " + age); 8 | // %d -> any integer - byte, short, int or long 9 | // %s -> String 10 | // %c -> char 11 | // %f -> float 12 | System.out.printf("You age is -> %d",age); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab024.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab024 { 4 | public static void main(String[] args) { 5 | int n = 9; 6 | System.out.printf("%d",n); 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab025.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab025 { 4 | public static void main(String[] args) { 5 | // int a = 10; 6 | // int b= 34; 7 | // System.out.println(a+b); 8 | // 9 | // String s1 = "PRamod"; 10 | // String s2 = "Dutta"; 11 | // System.out.println(s1+s2); 12 | 13 | String s3 = "Amit"; 14 | int x = 99; 15 | int y = 100; 16 | 17 | // System.out.println(x+y+s3); 18 | // System.out.println(s3+x+y); 19 | // System.out.println(x+s3+y); 20 | 21 | 22 | System.out.println(x+y+s3+y+s3+x+y); 23 | 24 | 25 | 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab026.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab026 { 4 | public static void main(String[] args) { 5 | String name = "Pramod"; 6 | System.out.printf("Your name is -> %s",name); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab027.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab027 { 4 | public static void main(String[] args) { 5 | int age = 10; // Decimal Number System 6 | int b = 0b1010; // Binday - Automation x 7 | int octal = 0101; // If your Automation you may be working with these numbers 8 | int hex = 0Xface; 9 | 10 | // https://www.rapidtables.com/convert/number/decimal-to-hex.html?x=10 11 | 12 | // ASCII Table 13 | // 0-9 48-57 14 | // A-Z 65-90 15 | // a-z 97-122 16 | // // 0-9 48-57 17 | 18 | 19 | 20 | 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab028.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab028 { 4 | public static void main(String[] args) { 5 | int age = 65; 6 | String name2 = "Pramod"; 7 | 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab029.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab029 { 4 | public static void main(String[] args) { 5 | // Calc 6 | double a = 10; 7 | double b = 34; 8 | double sum = a+b; 9 | double sub = a-b; 10 | double mul = a*b; 11 | double div = a/b; 12 | // double div = a/b; 13 | System.out.printf("Sum is %f\n",sum); 14 | 15 | System.out.printf("Sub is %f\n",sub); 16 | 17 | System.out.printf("Mul is %f\n",mul); 18 | 19 | System.out.printf("Div is %f\n",div); 20 | 21 | 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab030.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab030 { 4 | public static void main(String[] args) { 5 | int age = 65; 6 | //double age = 45; 7 | //. Local - within method 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab031.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab031 { 4 | public static void main(String[] args) { 5 | final int A=99; 6 | //A= 100; 7 | System.out.println(A); 8 | final String STR="TTA"; 9 | final double D1=999.99; 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab032.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab032 { 4 | public static void main(String[] args) { 5 | final double PIE = 3.14; 6 | //PIE = 3.145; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab033.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab033 { 4 | public static void main(String[] args) { 5 | double a = 34; 6 | double b = 10; 7 | double result = a%b; // Modulus - operator - Reminder 8 | System.out.println(result); 9 | 10 | // 10 | 34 | 3 - Q 11 | // | 30 | 12 | // ______ 13 | // 4 - Remainder 14 | 15 | System.out.println(89%10); 16 | 17 | 18 | 19 | 20 | 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab034.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab034 { 4 | public static void main(String[] args) { 5 | //int enum = 45; 6 | int Enum = 45; 7 | System.out.println(Enum); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab035.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab035 { 4 | public static void main(String[] args) { 5 | // Escape Chars 6 | char c = '\n'; // New line / Next Line 7 | char c1 = '\t'; // Add Tab 8 | char c2 = '\b'; // Backlash, delete 1 char 9 | char c3 = '\r'; // Backlash, delete 1 word 10 | // System.out.println("Pramod" + c3 + "Dutta"); 11 | // System.out.println("Pramod" + c2 + "Dutta"); 12 | // System.out.println("Pramod" + c1 + "Dutta"); 13 | System.out.println("Pramod" + c + "Dutta"); 14 | 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab036.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab036 { 4 | public static void main(String[] args) { 5 | // 6 | // int a = "pramod"; 7 | 8 | boolean b = true; 9 | boolean b1 = false; 10 | // boolean b12 = "yes"; 11 | // boolean b2 = 'A'; Not possible 12 | 13 | float f = 129.8763e2F; 14 | 15 | String str2=null; 16 | System.out.println(str2); 17 | 18 | 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab037.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab037 { 4 | public static void main(String[] args) { 5 | // ✅ Operators 6 | int age = 65; // 10000001 -> switch of / on 7 | // = Assignment Operator - Assign the value literal to the ref of data type 8 | 9 | // Arithmetic Operator +,-,/,*, 10 | // % 11 | int a = 10; 12 | int b = 23; 13 | System.out.println(a+b); 14 | System.out.println(a-b); 15 | System.out.println(a*b); 16 | System.out.println(a/b); 17 | 18 | // % 19 | System.out.println(a%b); // Remainders 20 | 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab038.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab038 { 4 | public static void main(String[] args) { 5 | // Unary Operator 6 | int age = +65; 7 | int lambo = -1; 8 | System.out.println(age); 9 | System.out.println(lambo+2); 10 | 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab039.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab039 { 4 | public static void main(String[] args) { 5 | String firstname = "PRAMOD"; 6 | String lastname = "DUTTA"; 7 | System.out.println(firstname + lastname); 8 | 9 | byte a = 10; 10 | byte b = 18; 11 | System.out.println(a+b); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab040.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab040 { 4 | public static void main(String[] args) { 5 | 6 | int age = 65; // unary plus 7 | int num = -1; // unary minus - 8 | System.out.println(age+num); 9 | 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab041.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab041 { 4 | public static void main(String[] args) { 5 | // Compound Assignment Operators 6 | int a = 10; 7 | // += , -=, /=, *= . %= 8 | // += -> 9 | a+=10; // a = a+10 10 | a-=10; // a = a-10 11 | a/=10; // a = a/10 12 | a*=10; // a = a*10 13 | 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab042.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab042 { 4 | public static void main(String[] args) { 5 | // Relational Operators -> boolean 6 | // // >, < >=,<=, == , != ( ! = ) - true or false. 7 | int a = 10; 8 | int b = 20; 9 | int sum = a+b; // operand a, b , operator =, + 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab043.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab043 { 4 | public static void main(String[] args) { 5 | // Relational Operators -> boolean 6 | // // >, < >=,<=, == , != ( ! = ) - true or false. 7 | int age_mamitha = 34; 8 | int age_pramod = 34; 9 | // boolean result = age_pramod > age_mamitha; 10 | // boolean result = age_pramod < age_mamitha; 11 | boolean result2 = age_pramod >= age_mamitha; // OR gate 12 | System.out.println(result2); 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab044.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab044 { 4 | public static void main(String[] args) { 5 | int a = 10; 6 | int b = 10; 7 | boolean c = (10 >= 10); // 10 > 10 or 10 = 10 8 | // OR GATE 9 | System.out.println(c); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab045.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab045 { 4 | public static void main(String[] args) { 5 | System.out.println( 10 == 10); // == Compare true values 6 | System.out.println( 10 >= 10); // 10> 10 or 10 = 10 7 | System.out.println( 10 <= 10); // 10 < 10 or 10 = 10 8 | System.out.println( 10 > 10); 9 | System.out.println( 10 < 10); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab046.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab046 { 4 | public static void main(String[] args) { 5 | boolean a = true; 6 | System.out.println(!a); 7 | System.out.println(!(10>20)); 8 | System.out.println(!!!!(30>90)); 9 | // System.out.println((30>90)!); 10 | 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab047.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab047 { 4 | public static void main(String[] args) { 5 | // || - OR 6 | 7 | System.out.println(true || true); 8 | System.out.println(true || false); 9 | System.out.println(false || true); 10 | System.out.println(false || false); 11 | 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab048.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab048 { 4 | public static void main(String[] args) { 5 | // And && // only true && true returns true 6 | // T || T -> T 7 | // T || F -> F 8 | // F || T -> F 9 | // F || F -> F 10 | 11 | System.out.println(true && true); 12 | System.out.println(true && false); 13 | System.out.println(false && true); 14 | System.out.println(false && false); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/july/ex_13072024/Lab049.java: -------------------------------------------------------------------------------- 1 | package july.ex_13072024; 2 | 3 | public class Lab049 { 4 | public static void main(String[] args) { 5 | // BIO 6 | int a = 12; 7 | boolean b = !(a > 10 || a < 5); // BODMAS 8 | System.out.println(b); 9 | // BODMAS stands for 10 | // Bracket, Of, Division, 11 | // Multiplication, Addition, and Subtraction. 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab050.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab050 { 4 | public static void main(String[] args) { 5 | // ✅ Operators 6 | int age = 65; 7 | int lambo = -1; 8 | // data_type variable_name(identifier) = variable _value(literals) 9 | // Unary = Only 1 operand, operator 10 | // age - operand, value - unary plus, = operator 11 | // lambo - operand, value - unary minus, = operator 12 | 13 | 14 | // Binary Operator 15 | int a = 10; 16 | int b = 23; 17 | int sum = a+b; 18 | // Binary - Arthe +,-,*,/.... 19 | // Two operand 20 | // a, b -> operand , + operator 21 | 22 | 23 | // Ternary Operator a,b,c - operand 24 | 25 | 26 | 27 | 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab051.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab051 { 4 | public static void main(String[] args) { 5 | // Arithmetic Operators 6 | // +,-,%,/,* 7 | 8 | // Compound Assignment Operators 9 | // +=, -=, /=, *= 10 | 11 | // Relational Operators 12 | // > , < , >= <=, !, != , == (compare two value) 13 | 14 | 15 | // Logical Operators 16 | // OR or and , || , && , ! 17 | 18 | // They will come in the future. -OOPs concepts 19 | 20 | // new Operator 21 | // instanceOf Operator 22 | 23 | 24 | // Optional to learn - digital Electronics 25 | // Bitwise - Not important for Automation 26 | // ~ - Bitwise Not, >> - Right shift, << Left Shift, ^ - XOR 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab052.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab052 { 4 | public static void main(String[] args) { 5 | // = and == 6 | int a = 10; // assign the values. 7 | boolean b = (10 == 11); // == Compare between the two values - True/False 8 | // === NOT PRESENT in the JAVA, === present Javascript 9 | System.out.println(a); 10 | System.out.println(b); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab053.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab053 { 4 | public static void main(String[] args) { 5 | byte a = 10; 6 | // Byte , bits - memory -> 1 Byte, 8 bits are used. 7 | long l = 10l; 8 | // memory - 8 Byte, 64 bits 9 | 10 | String s = "name"; // 8 Byte, 64 bits 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab054.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab054 { 4 | public static void main(String[] args) { 5 | byte a = 10; 6 | byte b = 23; 7 | int c = a+b; 8 | System.out.println(c); 9 | 10 | char a1 = 'A'; 11 | char b1 = 'B'; 12 | int c1 = a1+b1; // AB ->char 13 | System.out.println(c1); //(65+66) 14 | System.out.println('A' == 65); 15 | System.out.println('B' == 69); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab055.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab055 { 4 | public static void main(String[] args) { 5 | short s = 10; 6 | char c = 'A'; //65 7 | int ss = s+c; 8 | System.out.println(ss); 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab056.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab056 { 4 | public static void main(String[] args) { 5 | // Type Casting - Source and Destination conversion 6 | // Widening - Implicit, Explicit - lossless 7 | // Narrowing - Implicit, Explicit(with data type), loss 8 | 9 | 10 | // Widening 11 | byte b=10; 12 | int a=b; // VALID – Implicit Casting - JVM 13 | int a1= (int)b; // VALID – Explicit Casting 14 | System.out.println(a1); 15 | 16 | // Narrowing 17 | int val = 300; 18 | //byte b1 = val; // Invalid - Implicit Casting - JVM 19 | byte b1 = (byte)val; // InVALID – Explicit Casting - // Loss of data 20 | System.out.println(b1); 21 | 22 | 23 | 24 | 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab057.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab057 { 4 | public static void main(String[] args) { 5 | long phone_no = 9876543210L; 6 | // short s = phone_no; // Implicit Narrowing - JVM? 7 | short s = (short) phone_no; 8 | System.out.println(s); 9 | // JVM - GC - 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab058.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab058 { 4 | public static void main(String[] args) { 5 | int course = 100; 6 | float GST = 18.45F; 7 | //int total_price = course+GST; // Implicti Narrowing - JVM 8 | int total_price = course+(int)GST; // Explit narrowing - REAL time - money loss 9 | System.out.println(total_price); 10 | 11 | 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab059.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab059 { 4 | public static void main(String[] args) { 5 | int course = 100; 6 | float GST = 18.45F; 7 | float total_price = course+GST; 8 | System.out.println(total_price); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab060.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab060 { 4 | public static void main(String[] args) { 5 | // Increment (++) / Decrement (--) Operators 6 | // Pre and Post 7 | // Ready 8 | 9 | // pre - increment ++operand 10 | // value is incremented first and then stored in the result. 11 | // int a = 10; 12 | // int b = ++a; // a = a+1; 13 | // // Exp = 11 , a = 11 14 | // System.out.println(a); 15 | // System.out.println(b); 16 | 17 | 18 | // 19 | // int a = 10; 20 | // System.out.println(++a); 21 | // // Exp = 11 , a = 11 22 | 23 | 24 | // POST 25 | // value is stored in the result and incremented later 26 | int a_post = 10; 27 | System.out.println(a_post++); 28 | System.out.println(a_post); 29 | // Exp = 10 , a = 11 30 | 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab061.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab061 { 4 | public static void main(String[] args) { 5 | // int a = 10; 6 | // int result = a++; 7 | // System.out.println(a); 8 | // System.out.println(result); 9 | // 10 | // // Exp = 10 , a = 11? 11 | 12 | 13 | int a = 10; 14 | int result = ++a; 15 | System.out.println(a); 16 | System.out.println(result); 17 | 18 | // Exp = 11 , a = 11? 19 | 20 | 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab062.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab062 { 4 | public static void main(String[] args) { 5 | int a = 10; 6 | System.out.println(a++ + a); 7 | // A = a++ -> 10 , a = 11 8 | // + 9 | // B = a = 11 -> A+B = 10+11 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab063.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab063 { 4 | public static void main(String[] args) { 5 | int a = 10; 6 | System.out.println(a++ + ++a); 7 | System.out.println(a); 8 | // A - a++ -> Exp = 10 | a = 11 9 | // + - operator 10 | // B- a++ -> Exp = 12 | a = 12 11 | } 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab064.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab064 { 4 | public static void main(String[] args) { 5 | int a = 10; 6 | System.out.println(++a + ++a); 7 | System.out.println(a); 8 | // A -> ++a , Exp = 11 | a = 11 9 | // + -> nothing 10 | // B -> ++a Exp = 12 | a = 12 11 | // Exp = A+B = 23 , a = 12 12 | 13 | // a--, --a 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab065.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab065 { 4 | public static void main(String[] args) { 5 | int a = 10; 6 | System.out.println(++a + a++ + a++); 7 | System.out.println(a); 8 | // Part -> A -> ++a , Exp1 = 11 , a = 11 9 | // Part -> B -> a++ , Exp2 = 11 , a = 12 10 | // Part -> C -> a++, Exp3 = 12 , a = 13 11 | // op -> exp1+ exp2+exp3 12 | // a = 13 13 | 14 | 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab066.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab066 { 4 | public static void main(String[] args) { 5 | int a = 87; 6 | long b = 91; 7 | String s1 = "KK"; 8 | String s2 = "VV"; 9 | //System.out.println(s1+s2+a+b); 10 | System.out.println(s1+s2+(a+b)); 11 | //System.out.println(KK+vv+87+91); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab067.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab067 { 4 | public static void main(String[] args) { 5 | String name = "Pramod"; 6 | // String? - // Bunch of Chars - Collection of Chars 7 | // class - ? 8 | String name2 = new String("Pramod"); 9 | // How many ways we can a String - 2 10 | // = , new operator 11 | // = "SCP" // Sting constant Pool 12 | // new - Objects(heap) 13 | 14 | System.out.println(name.toLowerCase()); 15 | System.out.println(name.length()); 16 | System.out.println(name.toUpperCase()); 17 | System.out.println(name.charAt(2)); 18 | System.out.println(name.charAt(0)); 19 | System.out.println(name.charAt(10)); // Exception Index 10 out of bounds 20 | 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab068.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab068 { 4 | public static void main(String[] args) { 5 | String name = "Pramod"; // Assignment Operators 6 | String name2 = new String("Pramod"); // New Operator 7 | 8 | // Both of them, actually save the name, name2 in different ways JVM 9 | // How they store the values in the JVM? 10 | 11 | 12 | // SCP nad Heap - JVM 13 | 14 | 15 | 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab069.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab069 { 4 | public static void main(String[] args) { 5 | String s1 = "Pramod"; 6 | // 1 , SCP 7 | s1 = "Amit"; 8 | // 2 , SCP 9 | s1 = "Dutta"; 10 | // 3 . SCP 11 | s1 = "Pramod"; 12 | // 3, SCP 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab070.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab070 { 4 | public static void main(String[] args) { 5 | String s1 = new String("Pramod"); 6 | String s2 = new String("Pramod"); 7 | // 2, Heap area 8 | String s3 = s1; // (This doesn't mean this in the SCP) - S3 -> S1 (heap area) 9 | // 2, heap s3 -> s1 -> Pramod 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab071.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab071 { 4 | public static void main(String[] args) { 5 | String s1 = "Pramod"; 6 | String s2 = s1; 7 | System.out.println(s2); 8 | String s3 = s2.toLowerCase(); 9 | System.out.println(s3); 10 | System.out.println(s1); 11 | // 2 - Pramod, pramod - SCP 12 | 13 | 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab072.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab072 { 4 | public static void main(String[] args) { 5 | final String API_TOKEN = "0a9s890ds98ds9"; 6 | String BROWSER = "chrome"; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab073.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab073 { 4 | public static void main(String[] args) { 5 | String str1="Hello"; 6 | String str2=" Guys"; 7 | String str3="Hello Guys"; 8 | String str4= str1.concat(str2); // Hello Guys 9 | // SCAP - 4 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab074.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab074 { 4 | public static void main(String[] args) { 5 | String name = "The Testing Academy"; // SCP 6 | String name1 = "The Testing Academy"; // SCP 7 | 8 | String name2 = new String("The Testing Academy"); // Heap area (OA) 9 | 10 | // System.out.println(name == name1); // Check for the Ref 11 | // System.out.println(name.equals(name1)); // Check for the Content 12 | 13 | 14 | System.out.println(name1 == name2); // Check for the Ref 15 | System.out.println(name1.equals(name2)); // Check for the Content 16 | 17 | 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab075.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab075 { 4 | public static void main(String[] args) { 5 | String s1 = new String("pramod"); 6 | String s2 = new String("pramod"); 7 | String s3 = new String("pramod"); 8 | 9 | 10 | System.out.println(s1 == s2); // Check for the ref 11 | System.out.println(s2 == s3); // Check for the ref 12 | System.out.println(s2.equals(s3)); // Check for the Content 13 | 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab076.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab076 { 4 | public static void main(String[] args) { 5 | String s1 = "Pramod"; 6 | //String s1 = "P r a m o d"; 7 | // |0|1|2|3|4|5| 8 | char c = s1.charAt(5); 9 | System.out.println(c); 10 | s1 = s1.concat("Dutta"); // Pramod Dutta 11 | System.out.println(s1); 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab077.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab077 { 4 | public static void main(String[] args) { 5 | String s1 = "pramod"; 6 | // Non Primitive Types - String, Arrays, Class, ENUM.. more will come 7 | 8 | 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab078.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab078 { 4 | public static void main(String[] args) { 5 | String password = "Pramod@123"; 6 | String pass_u = password.toLowerCase(); 7 | System.out.println(pass_u); 8 | // pass_u == password 9 | System.out.println(pass_u == password); 10 | System.out.println(pass_u.equals(password)); 11 | System.out.println(pass_u.equalsIgnoreCase(password)); 12 | //Pramod@123 = pramod@123 = PRamod@123 = PraMod@123 13 | 14 | System.out.println(password.substring(0,3)); 15 | System.out.println(password.indexOf('r')); 16 | System.out.println(password.length()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab079.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab079 { 4 | public static void main(String[] args) { 5 | // Ternary operator. 6 | // ? if true do this : ele do that 7 | // int result = 10>40 ? 89 : 91; 8 | // System.out.println(result); 9 | int a1 = (30>40) ? 10: 20; 10 | System.out.println(a1); 11 | 12 | String str= 10 > 20 ? "10" : "TWENTY"; 13 | System.out.println(str); 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab080.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | 3 | public class Lab080 { 4 | public static void main(String[] args) { 5 | // Max between two numbers 6 | int a= 10; 7 | int b= 20; 8 | int max = a > b ? a : b; 9 | int min = a < b ? a : b; 10 | System.out.println(max); 11 | System.out.println(min); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/july/ex_14072024/Lab081.java: -------------------------------------------------------------------------------- 1 | package july.ex_14072024; 2 | import java.lang.Math; 3 | 4 | 5 | public class Lab081 { 6 | public static void main(String[] args) { 7 | double sq = Math.sqrt(2); 8 | int result = Math.max(10,23); 9 | System.out.println(sq); 10 | System.out.println(result); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab082.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | public class Lab082 { 4 | public static void main(String[] args) { 5 | // Condition and Loops 6 | // 7 | // Condition ? 8 | // age > 18 -> you allowed to / Vote 9 | // 10 | // if age > 18 -> vote, else -> not allowed. 11 | 12 | // Condition - Java -> switch , If 13 | // syntax 14 | // if (condition ==> true or false){ 15 | // 16 | // }else{ 17 | // 18 | // } 19 | 20 | int age = 35; 21 | if (age > 18) { 22 | System.out.println("Allowed to Vote!!"); 23 | } else { 24 | System.out.println("Not allowed!!"); 25 | } 26 | 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab083.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | public class Lab083 { 4 | public static void main(String[] args) { 5 | int a = 10; 6 | // a = 4 -> TRUE OR FASLE 7 | if( a == 4){ 8 | System.out.println("Haha"); 9 | }else{ 10 | System.out.println("LOL"); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab084.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | public class Lab084 { 4 | public static void main(String[] args) { 5 | boolean b = !true; 6 | if(b){ 7 | System.out.println("b is true"); 8 | }else { 9 | System.out.println("b is not true"); 10 | } 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab085.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | public class Lab085 { 4 | public static void main(String[] args) { 5 | boolean a = true; 6 | a = !a; 7 | if(2+2 < 4){ 8 | System.out.println("Inside the loop"); 9 | } 10 | System.out.println("Outside -> "+a); 11 | // Understand with debug -> checking the code line by line 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab086.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | public class Lab086 { 4 | public static void main(String[] args) { 5 | // Modulus - % 6 | // 10%2 -> 0 7 | // 11%2 -> 1 8 | // 2 | 11 | 5 - Q 9 | // 10 10 | // ----- 11 | // 1 - R 12 | 13 | int num = 11; 14 | if(num%2 == 0){ 15 | System.out.println("Even"); 16 | }else{ 17 | System.out.println("Odd"); 18 | } 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab087.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Lab087 { 6 | public static void main(String[] args) { 7 | // Take user input and check if number id even or odd. 8 | 9 | 10 | 11 | // Logic Building - Ready 12 | // 1. Figure out the inputs & // 2. Data type 13 | // Data type - . int 14 | // How to take input in the Java? - Scanner - class - 15 | // nextInt() -> input 16 | 17 | 18 | // 3. Do we need conversion or direclty 19 | // 4. Rough logic - num%2==0 even,odd 20 | // 5. optimize 21 | // int - size - 32 bit -> range( 2,147,483,647) 22 | 23 | Scanner sc = new Scanner(System.in); // obect of the scanner Class - OOPs 24 | System.out.println("Enter the num 1"); 25 | int user_input = sc.nextInt(); 26 | 27 | System.out.println(user_input); 28 | 29 | if(user_input%2==0){ 30 | System.out.println("Even"); 31 | }else { 32 | System.out.println("Odd"); 33 | } 34 | 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab088.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Lab088 { 6 | public static void main(String[] args) { 7 | // Max number in two inputs 8 | Scanner sc = new Scanner(System.in); 9 | System.out.println("Enter the num 1"); 10 | int num1 = sc.nextInt(); 11 | 12 | System.out.println("Enter the num 2"); 13 | int num2 = sc.nextInt(); 14 | 15 | // System.out.println(Math.max(num1,num2)); 16 | 17 | if (num1 > num2) { 18 | System.out.println(num1); 19 | } else if (num2 > num1) { 20 | System.out.println(num2); 21 | } else { 22 | System.out.println("Equal"); 23 | } 24 | 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab089.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Lab089 { 6 | public static void main(String[] args) { 7 | 8 | Scanner sc = new Scanner(System.in); 9 | System.out.println("Enter your age"); 10 | 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab090.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Lab090 { 6 | public static void main(String[] args) { 7 | // ✅ Grade Calculator: 8 | // Write a program that calculates and displays 9 | // the letter grade for a given numerical 10 | // score (e.g., A, B, C, D, or F) 11 | // based on the following grading scale: 12 | // A: 90-100 13 | // B: 80-89 14 | // C: 70-79 15 | // D: 60-69 16 | // F: 0-59 17 | 18 | 19 | // 1. Find the user Inputs 20 | // score - data type? - int -90 21 | // return -> grade - data-type - char - A 22 | // // // DAA- Ask for the confirmation of the doubts 23 | // Interviewer -> int, char 24 | // Scanner - > 25 | 26 | // 2. Basic Logic 27 | // if ( score >= 90 && score <= 100 ) -> return or print grade - A 28 | // else if score <=89 && score >= 80 -> return or orint grade - B 29 | // else if score <=79 && score >= 70 -> return or orint grade - C 30 | // D,E 31 | // // else -> grade -> F 32 | 33 | 34 | // 3. Write the code 35 | 36 | Scanner sc = new Scanner(System.in); 37 | System.out.println("Enter the Student Score!!"); 38 | int score = sc.nextInt(); 39 | 40 | char grade = 'F'; 41 | 42 | if(score >=90 && score <=100){ 43 | grade = 'A'; 44 | } 45 | else if(score >=80 && score <=89){ 46 | grade = 'B'; 47 | }else if (score >= 70 && score <= 79) { 48 | grade = 'C'; 49 | }else if (score >= 60 && score <= 69) { 50 | grade = 'D'; 51 | }else if( score <=0 || score > 100){ 52 | System.out.println("LOL!!, are you God?"); 53 | grade = 'O'; 54 | }else{ 55 | grade ='F'; 56 | } 57 | 58 | System.out.println("Your Grade is -> "+ grade); 59 | 60 | 61 | sc.close(); 62 | 63 | 64 | 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab091.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | public class Lab091 { 4 | public static void main(String[] args) { 5 | 6 | if (false) { 7 | System.out.println("1"); 8 | if (true) { 9 | System.out.println("2"); 10 | if (true) { 11 | System.out.println("3"); 12 | } 13 | } 14 | } 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab092.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Lab092 { 6 | public static void main(String[] args) { 7 | // If Else - Condition ( If, else If , else) - multiple condition 8 | 9 | // Switch - Better way to 2+ condition 10 | // Which day it is - Day to from 1 to 7 11 | // 3 -> Wed 12 | 13 | // MTWTFSS 14 | 15 | Scanner sc = new Scanner(System.in); 16 | System.out.println("Enter the day from 1 to 7, Tell What day it its"); 17 | int day = sc.nextInt(); 18 | 19 | switch (day){ 20 | case 1: 21 | System.out.println("Mon"); 22 | break; 23 | case 2: 24 | System.out.println("Tue"); 25 | break; 26 | case 3: 27 | System.out.println("Wed"); 28 | break; 29 | case 4: 30 | System.out.println("Thur"); 31 | break; 32 | case 5: 33 | System.out.println("Friday"); 34 | break; 35 | case 6: 36 | System.out.println("Sat"); 37 | break; 38 | case 7: 39 | System.out.println("Sun"); 40 | break; 41 | default: 42 | System.out.println("No idea, what day its"); 43 | break; 44 | } 45 | 46 | System.out.println(" ---- === Outside the Switch loop === -----"); 47 | 48 | 49 | 50 | 51 | 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab093.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Lab093 { 6 | public static void main(String[] args) { 7 | // Web Automation 8 | // I will ask user which browser you want me to run the code. 9 | // chrome -> start chrome, firefox -> firefox, edge -> execution edge 10 | 11 | Scanner sc = new Scanner(System.in); 12 | System.out.println("Enter the browser name!!, where you want to execute the program!"); 13 | String browserName = sc.next(); 14 | browserName = browserName.toLowerCase(); 15 | 16 | switch (browserName){ 17 | case "chrome": 18 | System.out.println("Starting the chrome browser"); 19 | // Further code to start the Chrome 20 | // Webdriver driver = new Chrome(); // Selenium Code 21 | break; 22 | case "firefox": 23 | System.out.println("Starting the firefox browser"); 24 | // Further code to start the Firefox 25 | // Webdriver driver = new Firfox(); // Selenium Code 26 | break; 27 | case "edge": 28 | System.out.println("Execute the Edge Code"); 29 | break; 30 | default: 31 | System.out.println("I have not idea which browser is this"); 32 | break; 33 | } 34 | 35 | 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab094.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Lab094 { 6 | public static void main(String[] args) { 7 | // Take a user input as char and Tell the user if it is a vowel 8 | // aeiou 9 | 10 | Scanner sc = new Scanner(System.in); 11 | System.out.println("Enter a char, I will tell you, If it is a vowel or not!"); 12 | char user_input = sc.next().charAt(0); 13 | System.out.println(user_input); 14 | 15 | switch (user_input) { 16 | case 'a': 17 | System.out.println("Vowel"); 18 | break; 19 | case 'e': 20 | System.out.println("Vowel"); 21 | break; 22 | case 'i': 23 | System.out.println("Vowel"); 24 | break; 25 | case 'o': 26 | System.out.println("Vowel"); 27 | break; 28 | case 'u': 29 | System.out.println("Vowel"); 30 | break; 31 | default: 32 | System.out.println("Not a Vowel, It it Consonant"); 33 | 34 | } 35 | 36 | switch (user_input){ 37 | case 'a','i','o','u','e': 38 | System.out.println("Vowel"); 39 | break; 40 | default: 41 | System.out.println("Not a Vowel, It it Consonant"); 42 | 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab095.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | public class Lab095 { 4 | public static void main(String[] args) { 5 | 6 | // int a = 10; 7 | // switch (a) { 8 | // 9 | // } 10 | 11 | char ch = 'A'; // 65 12 | switch (ch) { 13 | } 14 | 15 | // boolean b = true; 16 | // switch (b) { 17 | // } 18 | 19 | long a11 = 30l; 20 | switch ((int) a11) { 21 | } 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab096.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | public class Lab096 { 4 | public static void main(String[] args) { 5 | int a = 98; 6 | switch (a) { 7 | case 98: 8 | System.out.println("Val - 98"); 9 | // case 98: 10 | // System.out.println("Val - 98"); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab097.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | public class Lab097 { 4 | public static void main(String[] args) { 5 | // JDK > 13 6 | 7 | int itemcode = 006; 8 | switch (itemcode){ 9 | case 001,002,003: 10 | System.out.println("It is Electronic Gadget!"); 11 | break; 12 | case 004,005,007: 13 | System.out.println("It is Mechinal Gadget!"); 14 | break; 15 | default: 16 | System.out.println("None"); 17 | 18 | } 19 | 20 | 21 | 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab098.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | public class Lab098 { 4 | public static void main(String[] args) { 5 | // JDK > 13 6 | 7 | int itemCode = 001; 8 | 9 | switch (itemCode) { 10 | case 001 -> System.out.println("It's a laptop!"); 11 | case 002 -> System.out.println("It's a desktop!"); 12 | case 003, 004 -> System.out.println("It's a mobile phone!"); 13 | default -> System.out.println("Heloo!"); 14 | } 15 | 16 | } 17 | 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab099.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | public class Lab099 { 4 | public static void main(String[] args) { 5 | System.out.println((10 - 4) + 3 *4); 6 | 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab100.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | public class Lab100 { 4 | public static void main(String[] args) { 5 | // JDK > 13 6 | char code = 'B'; 7 | int val = switch (code){ 8 | case 'A': 9 | yield 65; 10 | case 'B': 11 | yield 66;//// return 12 | default: 13 | throw new IllegalStateException("Unexpected value: " + code); 14 | }; 15 | System.out.println(val); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab101.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Lab101 { 6 | public static void main(String[] args) { 7 | // Write a program name, age, salary - print it 8 | Scanner sc = new Scanner(System.in); 9 | System.out.println("Enter your name"); 10 | String name = sc.next(); 11 | 12 | System.out.println("Enter your age"); 13 | int age = sc.nextInt(); 14 | 15 | System.out.println("Enter your Salary"); 16 | double salary = sc.nextDouble(); 17 | 18 | System.out.println("Your details are " + name); 19 | System.out.println("Your age is " + age); 20 | System.out.println("Your Salary is " + salary); 21 | 22 | 23 | sc.close(); 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab102.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | public class Lab102 { 4 | public static void main(String[] args) { 5 | 6 | int a = 11; 7 | switch (-1){ 8 | default: 9 | System.out.println("Default"); 10 | break; 11 | case -1: 12 | System.out.println("10"); 13 | break; 14 | case 9: 15 | System.out.println("10"); 16 | break; 17 | } 18 | 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab103.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Lab103 { 6 | public static void main(String[] args) { 7 | // Program to Check 8 | // if a Number is Positive 9 | // , Negative, 10 | // or Zero. 11 | 12 | 13 | Scanner sc = new Scanner(System.in); 14 | System.out.println("Enter yur number!"); 15 | int num = sc.nextInt(); 16 | 17 | 18 | if(num> 0 ){ 19 | System.out.println("Positive Number"); 20 | }else if( num < 0){ 21 | System.out.println("Negative Number"); 22 | }else{ 23 | System.out.println("Zero"); 24 | } 25 | 26 | 27 | 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab104.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Lab104 { 6 | public static void main(String[] args) { 7 | //Program to Find the Largest Among Three Numbers: 8 | Scanner sc = new Scanner(System.in); 9 | System.out.println("Enter the Num 1"); 10 | int num1 = sc.nextInt(); 11 | System.out.println("Enter the Num 2"); 12 | int num2 = sc.nextInt(); 13 | System.out.println("Enter the Num 3"); 14 | int num3 = sc.nextInt(); 15 | 16 | 17 | // num 1 > num2 && num1 > num3 -> num1 18 | // num 2 > num1 && num2 > num3 -> num2 19 | // num 3 20 | 21 | if (num1 >= num2 && num1 >= num3) { 22 | System.out.println(num1); 23 | } else if (num2 >= num1 && num2 >= num3) { 24 | System.out.println(num2); 25 | } else { 26 | System.out.println(num3); 27 | } 28 | 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/july/ex_20072024/Lab105.java: -------------------------------------------------------------------------------- 1 | package july.ex_20072024; 2 | 3 | public class Lab105 { 4 | public static void main(String[] args) { 5 | 6 | char ch = 'a'; 7 | if ( ch == 'a' || ch == 'e' || ch =='o' || ch == 'i' || ch == 'u'){ 8 | System.out.println("Vowel"); 9 | }else{ 10 | System.out.println("Consonant"); 11 | } 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab106.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab106 { 4 | public static void main(String[] args) { 5 | 6 | // Condition -> If else, switch ( multiple conditions) 7 | 8 | 9 | // Loops -> For, while, do while - perform a task multiple times. 10 | // Iterative, repetition 11 | 12 | 13 | System.out.println(1); 14 | System.out.println(2); 15 | System.out.println(3); 16 | System.out.println(4); 17 | System.out.println(5); 18 | System.out.println(".."); 19 | System.out.println(10); 20 | 21 | 22 | // Loop a here to perform a task which is repetitive in nature. 23 | 24 | // for loop 25 | // for(A;BC) { 26 | // Task which you want to perform multiple time. 27 | // } 28 | 29 | // A - initialization 30 | // B - Condition for termination 31 | // C - increment / decrement -> updation 32 | 33 | 34 | for(int i=1;i <=10;++i){ 35 | // here is the code you want to execute 36 | System.out.println("Hi"+ i); 37 | } 38 | 39 | 40 | 41 | 42 | 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab107.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab107 { 4 | public static void main(String[] args) { 5 | 6 | int age = 34; 7 | int pramod_dutta = 34; 8 | String name = "Amit"; 9 | 10 | for (int pramod=1; pramod < 6; pramod++) { // 1 to 5 11 | System.out.println(pramod); /// 5<5 12 | } 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab108.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab108 { 4 | public static void main(String[] args) { 5 | for (int _1 = 0; _1 <= 10; _1++) { // 0 to 10 6 | System.out.println(_1); 7 | } 8 | 9 | // for( A ;B ; C) 10 | // A -> Initialization -> JVM What variable, where you are starting point 11 | // B - Condition -> When you want this to stop. 12 | // C -> Increment / Decrement 13 | 14 | 15 | 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab109.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab109 { 4 | public static void main(String[] args) { 5 | for (int i = 0; i > 1 ; i++) { 6 | System.out.println(i); 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab110.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab110 { 4 | public static void main(String[] args) { 5 | for (int i = 0; i >= 1 ; i++) { 6 | System.out.println(i); 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab111.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab111 { 4 | public static void main(String[] args) { 5 | for (int i = 0; ; i++) { 6 | System.out.println(i); 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab112.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab112 { 4 | public static void main(String[] args) { 5 | final boolean b1 = true; 6 | // b1 = false; final this is fixed now 7 | // for (int i=0;b1;i++){ 8 | // System.out.println("Hello"); 9 | // } 10 | 11 | // for (int i=0;;){ 12 | // System.out.println("Hello"); 13 | // } 14 | 15 | // for (;;){ 16 | // System.out.println("Hello"); 17 | // } 18 | 19 | for(float f=0.0f;f<10.67;f++){ 20 | System.out.println("Hi,Float -> "+ f); 21 | } 22 | 23 | for(byte f=0;f<10.67;f++){ 24 | System.out.println("Hi,Float -> "+ f); 25 | } 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab113.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab113 { 4 | public static void main(String[] args) { 5 | for (long i = 1; i < 10; i++) { 6 | System.out.println(i); 7 | } // numberal - float, int, short, byte,long, char 8 | 9 | for (int i = 0; i < 10; i++) { 10 | 11 | } 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab114.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab114 { 4 | public static void main(String[] args) { 5 | for (char c = 'a'; c <= 'z';c++){ 6 | System.out.println(c); 7 | } 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab115.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab115 { 4 | public static void main(String[] args) { 5 | for (int i = 0; i > 0 ; i--) { 6 | System.out.println(i); 7 | } 8 | // 10 9 | //9 10 | //8 11 | //7 12 | //6 13 | //5 14 | //4 15 | //3 16 | //2 17 | //1 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab116.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab116 { 4 | public static void main(String[] args) { 5 | int i = 10; 6 | for (; i>0 ; i--) { 7 | System.out.println(i); 8 | } 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab117.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab117 { 4 | public static void main(String[] args) { 5 | for (int i = 0; i < 10 ;i++) { 6 | System.out.println("Pramod"); 7 | } 8 | System.out.println("End"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab118.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab118 { 4 | public static void main(String[] args) { 5 | 6 | for (int i = 0; i < 10 ; i++) { // 0 to 9 -> 7 | System.out.println("Pramod"); 8 | } 9 | 10 | // | i=0 , 1 | 11 | // | i=1 , 2 | 12 | // | i=2 , 3 | 13 | // | i=3 , 4 | 14 | // | i=4 , 5 | 15 | // | i=5 , 6 | 16 | // | i=6 , 7 | 17 | // | i=7 , 8 | 18 | // | i=8 , 9 | 19 | // | i=9 , 10 | 20 | 21 | for (int i = 1; i <= 10 ; i++) { // 1 to 10 22 | System.out.println("Dutta"); 23 | 24 | 25 | } 26 | 27 | // | i=1 , 1 | 28 | // | i=2 , 2 | 29 | // | i=3 , 3 | 30 | // | i=4 , 4 | 31 | // | i=5 , 5 | 32 | // | i=6 , 6 | 33 | // | i=7 , 7 | 34 | // | i=8 , 8 | 35 | // | i=9 , 9 | 36 | // | i=10 , 10 | 37 | 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab119.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab119 { 4 | public static void main(String[] args) { 5 | // Loop with condition 6 | // 7 | for (int i = 1; i <= 10; i++) { 8 | // i from 1 to 10, 10 times 9 | if (i == 5) { 10 | System.out.println("Five"); 11 | } else { 12 | System.out.println(i); 13 | } 14 | } 15 | 16 | // 1 17 | //2 18 | //3 19 | //4 20 | //Five 21 | //6 22 | //7 23 | //8 24 | //9 25 | //10 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab120.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab120 { 4 | public static void main(String[] args) { 5 | // Loop with condition 6 | // 7 | for (int i = 1; i <= 10; i++) { 8 | System.out.println(i); 9 | if (i == 5) { 10 | break; 11 | } 12 | 13 | 14 | } 15 | 16 | // i = 1 -> 1 17 | // i = 2 -> 2 18 | // i = 3 -> 3 19 | // i = 4 -> 4 20 | // i = 5 -> Out of loop 21 | 22 | 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab121.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab121 { 4 | public static void main(String[] args) { 5 | for (int i = 0; i <=50 ; i++) { 6 | if(i%2 == 0){ // if(i%2 != 0){ 7 | System.out.println(i); 8 | } 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab122.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab122 { 4 | public static void main(String[] args) { 5 | for (int i = 0; i < 10; i++) { // i = 0 to 9, times = 10 6 | System.out.println(i); 7 | if( i == 5){ 8 | continue; 9 | } 10 | System.out.println("After!!"); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab123.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab123 { 4 | public static void main(String[] args) { 5 | for (int i = 0; i <= 50; i++) { // i = 0 to 50, times = 51 6 | if (i % 2 == 0) { 7 | System.out.println("Even -> " + i); 8 | continue; 9 | } 10 | System.out.println("Odd -> "+ i); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab124.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab124 { 4 | public static void main(String[] args) { 5 | for (int i = 0; i <= 50; i++) { // i = 0 to 50, times = 51 6 | if (i % 2 == 0) { 7 | System.out.println("Even -> " + i); 8 | continue; 9 | } 10 | System.out.println("Odd -> "+ i); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab125.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab125 { 4 | public static void main(String[] args) { 5 | for (int i = 1; i <= 100; i++) { // i = 1 to 100, times = 100 6 | System.out.println(i); 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab126.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab126 { 4 | public static void main(String[] args) { 5 | // Loops - while and dowhile 6 | 7 | // while - A, B, C 8 | // // A - Init 9 | // // B - Condition 10 | // // C - Increment / Decrement 11 | 12 | int i = 0; // A 13 | while(i<=10){ // B 14 | System.out.println(i); 15 | i++; //C 16 | } 17 | 18 | // for (int j = 0; j <=10 ; j++) { 19 | // System.out.println(j); 20 | // } 21 | } 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab127.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab127 { 4 | public static void main(String[] args) { 5 | int modi = 0; 6 | while(modi <=15){ 7 | System.out.println("modi do the work"); 8 | modi++; 9 | } 10 | } 11 | 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab128.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab128 { 4 | public static void main(String[] args) { 5 | // while (true){ 6 | // System.out.println("Pramod"); 7 | // } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab129.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab129 { 4 | public static void main(String[] args) { 5 | 6 | int i1 = 10; 7 | while(i1>=1){ 8 | System.out.println(i1); 9 | i1--; 10 | } 11 | 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab130.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Lab130 { 6 | public static void main(String[] args) { 7 | // Coding Program 8 | // Factorial Program 9 | // n = 5 -> Fact = 5*4*3*2*1 = 120 10 | // n = 1 -> Fact = 1*1 -> 1 11 | // n = 3 -> Fact = 3*2*1 -> 6 12 | 13 | Scanner sc = new Scanner(System.in); 14 | System.out.println("Enter a num,will print Factorial"); 15 | int n = sc.nextInt(); 16 | 17 | int fact = 1; 18 | // 5 -> i = 1 to 5 - 1*2 = fact, 19 | for (int i = 1; i <=n ; i++) { 20 | fact = fact*i; 21 | } 22 | System.out.println(fact); 23 | 24 | sc.close(); 25 | 26 | 27 | 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab131.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Lab131 { 6 | public static void main(String[] args) { 7 | // while, for -? 8 | // do while - while - 1 change - minor change 9 | 10 | // While -> int -> condition -> body -> increment / decrement 11 | 12 | // Do While 13 | // int -> body -> condition -> incre / drement 14 | 15 | int a = 0; 16 | do { 17 | System.out.println(a); 18 | a++; 19 | }while(a < 10); 20 | 21 | 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab132.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab132 { 4 | public static void main(String[] args) { 5 | int i = 10; 6 | // while (i<10){ 7 | // System.out.println(i); 8 | // i++; 9 | // } 10 | 11 | do{ 12 | System.out.println(i); 13 | i++; 14 | }while(i<10); 15 | 16 | 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab133.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Lab133 { 6 | // For and if 7 | 8 | // FizzBuzz Problem: 9 | // Write a program that prints numbers from 1 to 100. 10 | // For multiples of 3, print "Fizz" instead of the number, 11 | // and for the multiples of 5, print "Buzz". 12 | // For numbers which are multiples of both 3 and 5, 13 | // print "FizzBuzz". 14 | 15 | 16 | public static void main(String[] args) { 17 | Scanner sc = new Scanner(System.in); 18 | System.out.println("Enter the Max number"); 19 | int n = sc.nextInt(); 20 | 21 | 22 | for (int i = 1; i <= n; i++) { 23 | if (i % 3 == 0 && i % 5 == 0) { 24 | System.out.println("FizzBuzz"); 25 | } else if (i % 3 == 0) { 26 | System.out.println("Fizz"); 27 | } else if (i % 5 == 0) { 28 | System.out.println("Buzz"); 29 | } else { 30 | System.out.println(i); 31 | } 32 | } 33 | } 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab134.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab134 { 4 | public static void main(String[] args) { 5 | // Block of code which we can reuse. 6 | // Pre-built 7 | // User created / defined 8 | int result = Math.max(3,4); 9 | int result2 = Math.max(10,12); 10 | System.out.println(result); 11 | System.out.println(result2); 12 | 13 | 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab135.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | public class Lab135 { 4 | public static void main(String[] args) { 5 | // Functions 6 | // Block of code which we can reuse. 7 | // 1. Pre-built - Math.max() 8 | // 2. User created / defined 9 | 10 | // Two component of the functions 11 | // 1. Define 12 | // 2. Call the function 13 | 14 | 15 | // Call the function 16 | for (int i = 0; i < 5; i++) { 17 | greet(); 18 | } 19 | 20 | greet2(); 21 | 22 | } 23 | 24 | 25 | // 1. Define 26 | static void greet(){ 27 | System.out.println("Hi, How are you?"); 28 | } 29 | 30 | static void greet2(){ 31 | System.out.println("greet2"); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/july/ex_21072024/Lab136.java: -------------------------------------------------------------------------------- 1 | package july.ex_21072024; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Lab136 { 6 | public static void main(String[] args) { 7 | // Functions 8 | // Block of code which we can reuse. 9 | // 1. Pre-built - Math.max() 10 | // 2. User created / defined 11 | 12 | // Two component of the functions 13 | // 1. Define 14 | // 2. Call the function 15 | 16 | // 1.Without Parameters and Without Return Type 17 | // 2.Without Parameters but With Return Type 18 | // 3.With Parameters and Without Return Type 19 | // 4. With Parameters and With Return Type 20 | 21 | function_type1(); 22 | 23 | System.out.println( " --------------- "); 24 | 25 | String name = function_type2(); 26 | System.out.println(name); 27 | 28 | System.out.println( " --------------- "); 29 | 30 | 31 | function_type3("Amit"); 32 | function_type3("123"); 33 | 34 | 35 | System.out.println( " --------------- "); 36 | 37 | Scanner sc = new Scanner(System.in); 38 | int a = sc.nextInt(); 39 | int sum_result = function_type4(a,5); 40 | System.out.println("O/P -> "+sum_result); 41 | 42 | 43 | 44 | 45 | } 46 | 47 | // 1.Without Parameters and Without Return Type 48 | static void function_type1() { 49 | System.out.println("1.Without Parameters and Without Return Type"); 50 | } 51 | 52 | // 2.Without Parameters but With Return Type 53 | static String function_type2() { 54 | System.out.println("2.Without Parameters but With Return Type"); 55 | return "Pramod"; 56 | } 57 | 58 | // 3.With Parameters and Without Return Type 59 | static void function_type3(String name){ 60 | System.out.println("3.With Parameters and Without Return Type"); 61 | System.out.println("You have shared -> " + name); 62 | } 63 | 64 | 65 | // 4. With Parameters and With Return Type 66 | static int function_type4(int a,int b){ 67 | System.out.println("4. With Parameters and With Return Type"); 68 | return a+b; 69 | } 70 | 71 | 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/july/ex_27072024/Lab137.java: -------------------------------------------------------------------------------- 1 | package july.ex_27072024; 2 | 3 | public class Lab137 { 4 | public static void main(String[] args) { 5 | // dataType[] arrayName; 6 | // Data Types 7 | // Primitive 8 | // byte, short, int, long, double, float, char, boolean 9 | // Non Primitive 10 | // String, Class, enum 11 | 12 | int[] marks_10_board = {90, 91, 95, 99, 100, 78}; 13 | float[] gst_pad = {18.45f, 91.87f, 95.78f, 99.00f, 100.00f, 78.98f}; 14 | // int[] marks_10_board = [90, 91, 95, 99, 100, 78]; - Not possible 15 | String shoppling_list[] = {"bread", "butter", "milk", "curd"}; 16 | 17 | // int[] marks_12_board = {95,96,94,91,"Pramod"}; 18 | char [] grades = {'A','B','C','D','E','F'}; 19 | char [] grades_small = {'a','c','C','D','e','F', '#','@','%'}; 20 | // camelCase = pramoddutta -> pramodDutta 21 | // greetme -> greetMe 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/july/ex_27072024/Lab138.java: -------------------------------------------------------------------------------- 1 | package july.ex_27072024; 2 | 3 | public class Lab138 { 4 | public static void main(String[] args) { 5 | 6 | int[] marks_10_board = {90, 91, 95, 99, 100, 78}; 7 | // elements are fixed. 8 | // len -> 6 9 | // who index - 3 -> 10 | System.out.println(marks_10_board.length); 11 | System.out.println(marks_10_board[3]); // 99 12 | System.out.println(marks_10_board[0]); // 90 13 | System.out.println(marks_10_board[-1]); // ArrayIndexOutOfBoundsException 14 | // System.out.println(marks_10_board[10]); 15 | 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/july/ex_27072024/Lab139.java: -------------------------------------------------------------------------------- 1 | package july.ex_27072024; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Lab139 { 6 | public static void main(String[] args) { 7 | 8 | // Arrays -> new 9 | int[] marks = new int[3]; 10 | // index - 0,1,2 11 | // len - 3 12 | System.out.println(marks[0]); 13 | System.out.println(marks[1]); 14 | System.out.println(marks[2]); 15 | Scanner sc = new Scanner(System.in); 16 | marks[0] = sc.nextInt(); 17 | marks[1] = 92; 18 | marks[2] = 93; 19 | System.out.println(marks[0]); 20 | System.out.println(marks[1]); 21 | System.out.println(marks[2]); 22 | // System.out.println(marks[10]); // AIOBE 23 | 24 | 25 | boolean[] is_married = {true, false, true}; 26 | // To Print 27 | 28 | for (int i = 0; i < marks.length; i++) { 29 | // i = 0,1,2 30 | System.out.println(i + " -> " + marks[i]); 31 | } 32 | 33 | 34 | String weekDays[] = {"Sunday", "Monday", "Tuesday", "Wednesday"}; 35 | for (int i = 0; i < weekDays.length; i++) { 36 | System.out.println(weekDays[i]); 37 | } 38 | 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/july/ex_27072024/Lab140.java: -------------------------------------------------------------------------------- 1 | package july.ex_27072024; 2 | 3 | public class Lab140 { 4 | public static void main(String[] args) { 5 | int[] numbers = {10, 20, 30, 40, 50}; 6 | for (int i = 0; i < numbers.length; i++) { 7 | System.out.println(numbers[i] * 2); 8 | 9 | // len -> 5 10 | // index -> 0, 1,2,3,4 11 | // // i = 0,1,2,3,4 12 | // i = 0 10*2 -> 20 13 | // i = 1 20*2 -> 40 14 | // i = 2 30*2 -> 60 15 | // i = 3 40*2 -> 80 16 | // i = 4 50*2 -> 100 17 | // 20,40,60,80,100 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/july/ex_27072024/Lab141.java: -------------------------------------------------------------------------------- 1 | package july.ex_27072024; 2 | 3 | public class Lab141 { 4 | public static void main(String[] args) { 5 | int[] a = new int[4]; 6 | a[3] = 90; 7 | System.out.println(a[2]); 8 | System.out.println(a[3]); 9 | System.out.println(a[0]); 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/july/ex_27072024/Lab142.java: -------------------------------------------------------------------------------- 1 | package july.ex_27072024; 2 | 3 | public class Lab142 { 4 | public static void main(String[] args) { 5 | final int[] ages = new int[4]; 6 | ages[3] = 78; 7 | System.out.println(ages[3]); 8 | 9 | final int a = 10; 10 | //a = 90; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/july/ex_27072024/Lab143.java: -------------------------------------------------------------------------------- 1 | package july.ex_27072024; 2 | 3 | public class Lab143 { 4 | public static void main(String[] args) { 5 | final float pi = 3.14F; 6 | 7 | // Disadvantage of array 8 | //1. Fixed Data Type (homo) 9 | //2. Fixed Length. 10 | // 3. wastage of memory 11 | int [] ages = new int[100]; 12 | ages[1] = 99; 13 | ages[1] = 100; 14 | System.out.println(ages[1]); // 0 99 00000000... 15 | 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/july/ex_27072024/Lab144.java: -------------------------------------------------------------------------------- 1 | package july.ex_27072024; 2 | 3 | public class Lab144 { 4 | public static void main(String[] args) { 5 | 6 | int[] int_array = {34,45,43}; 7 | long[] l_array = {34l, 45l,43l}; 8 | float[] f_array = {45.56f, 32.34f, 43.43f}; 9 | double[] d_array = {34.3, 43.4, 12.32}; 10 | boolean[] b_array = {true,false,true,false}; 11 | char[] c_array = {'A','B','D'}; 12 | 13 | String names[] = {"Pramod","Amit","Alok"}; 14 | String[] args1 = {"Pramod","Amit","Alok"}; 15 | 16 | int ages[] = new int[4]; 17 | int[] ages1 = new int[4]; 18 | 19 | 20 | 21 | 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/july/ex_27072024/Lab145.java: -------------------------------------------------------------------------------- 1 | package july.ex_27072024; 2 | 3 | public class Lab145 { 4 | public static void main(String[] args) { 5 | if (args.length > 0) { 6 | for (int i = 0; i < args.length ; i++) { 7 | System.out.println(args[i]); 8 | } 9 | 10 | }else{ 11 | System.out.println("No Arguments given"); 12 | } 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/july/ex_27072024/Lab146.java: -------------------------------------------------------------------------------- 1 | package july.ex_27072024; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Lab146 { 6 | public static void main(String[] args) { 7 | // Where we take the user input of the 5 subjects - Avg of the subject. 8 | // Figure inputs - float, scanner class 9 | 10 | Scanner sc = new Scanner(System.in); 11 | float [] marks = new float[5]; 12 | for (int i = 0; i < marks.length; i++) { 13 | System.out.println("Enter the marks of the sub " + (i + 1)); 14 | marks[i] = sc.nextFloat(); 15 | } 16 | 17 | // // Optionally, you can print out the marks to verify input 18 | // for (int i = 0; i < marks.length; i++) { 19 | // System.out.println("Marks of sub " + (i + 1) + ": " + marks[i]); 20 | // } 21 | 22 | 23 | float avg = (marks[0]+ marks[1]+ marks[2]+ marks[3]+ marks[4])/5; 24 | System.out.println("Avg is -> "+avg); 25 | 26 | int j = 0; 27 | while (j < marks.length){ 28 | System.out.println(marks[j]); 29 | j++; 30 | } 31 | 32 | sc.close(); 33 | 34 | 35 | 36 | 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/july/ex_27072024/Lab147.java: -------------------------------------------------------------------------------- 1 | package july.ex_27072024; 2 | 3 | import java.util.Arrays; 4 | 5 | public class Lab147 { 6 | public static void main(String[] args) { 7 | // Find the Max in the Arrays 8 | // Find the Max Salary, Min in the Salary Array 9 | int[] salaries = {7, 10, 4, 13, 25, 18, 9, 8, 17}; 10 | // Infsys - Autoamtion Interview 11 | int max = salaries[0];; 12 | int min = salaries[0]; 13 | for (int i = 0; i < salaries.length ; i++) { 14 | if( salaries[i] > max){ 15 | max = salaries[i]; 16 | } 17 | if(min > salaries[i]){ 18 | min = salaries[i]; 19 | } 20 | } 21 | 22 | System.out.println(max); 23 | System.out.println(min); 24 | 25 | 26 | // Sort -> find the last one - 27 | // Arrays.sort(salaries); 28 | // System.out.println(salaries[salaries.length-1]); 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/july/ex_27072024/Lab148.java: -------------------------------------------------------------------------------- 1 | package july.ex_27072024; 2 | 3 | public class Lab148 { 4 | public static void main(String[] args) { 5 | // Single-dimensional arrays 6 | // have only one dimension, representing a list of elements. 7 | int [] ages = {90,91,93}; 8 | int [] ages2 = new int[10]; 9 | 10 | // Multi-dimensional arrays 11 | // have two or more dimensions, representing a table or grid of elements. 12 | // AT - 2D, 3D - Coding Questions. 13 | int[] array_1d = {450, 50, 321}; 14 | 15 | 16 | // 2D 17 | int[][] array_2d_2 = new int[3][3]; 18 | // |0|0|0| 19 | // |0|0|0| 20 | // |0|0|0| 21 | array_2d_2[0][0] = 34; 22 | // |34,0,0| 23 | // |0,0,0| 24 | // |0,0,0| 25 | array_2d_2[0][1] = 12; 26 | // |34,12,0| 27 | // |0,0,0| 28 | // |0,0,0| 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/july/ex_27072024/Lab149.java: -------------------------------------------------------------------------------- 1 | package july.ex_27072024; 2 | 3 | public class Lab149 { 4 | public static void main(String[] args) { 5 | int[][] array_2d = { 6 | {34, 12, 11}, 7 | {34, 12, 34}, 8 | {11, 23, 98} 9 | }; 10 | 11 | // R - 3 - i -> 0 to 2 12 | // C - 3 j -> 0 to 2 13 | 14 | for (int i = 0; i < array_2d.length; i++) { 15 | for (int j = 0; j < array_2d[i].length; j++) { 16 | System.out.print(array_2d[i][j]); 17 | System.out.print("\t"); 18 | } 19 | System.out.println(); 20 | } 21 | 22 | // i = 0, j -> 0,1,2 23 | // i = 1 , j -> 0, 1,2 24 | // i = 2 , j -> 0, 1,2 25 | 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/july/ex_27072024/Lab150.java: -------------------------------------------------------------------------------- 1 | package july.ex_27072024; 2 | 3 | public class Lab150 { 4 | public static void main(String[] args) { 5 | 6 | int[][] array_2d = { 7 | {34, 1}, 8 | {34, 2}, 9 | {34, 3} 10 | }; 11 | 12 | int row = array_2d.length; 13 | for (int i = 0; i < row; i++) { // Row 0,1 14 | for (int j = 0; j < array_2d[i].length; j++) { // Column , 0,1,2 15 | System.out.print(array_2d[i][j]); 16 | System.out.print("\t"); 17 | } 18 | System.out.println(""); 19 | } 20 | 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/july/ex_27072024/Lab151.java: -------------------------------------------------------------------------------- 1 | package july.ex_27072024; 2 | 3 | public class Lab151 { 4 | public static void main(String[] args) { 5 | // String - Bunch of Chars. 6 | // 7 | String s1 = new String("pramod"); // Heap Area 8 | String s2 = "pramod"; // String constant pool 9 | 10 | // String - Immutable in nature. 11 | System.out.println(s1.length()); 12 | System.out.println(s1.indexOf("p")); 13 | System.out.println(s1.charAt(0)); 14 | System.out.println(s1.toLowerCase()); 15 | 16 | 17 | 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/july/ex_27072024/Lab152.java: -------------------------------------------------------------------------------- 1 | package july.ex_27072024; 2 | 3 | public class Lab152 { 4 | public static void main(String[] args) { 5 | // Strings - imutable in nature 6 | // StringBuilder , StringBuffer 7 | String s1 = "PRAMOD"; 8 | s1 = "Dutta"; 9 | 10 | StringBuffer stringBuffer = new StringBuffer("Pramod"); 11 | // change the value of string - Buffer 12 | stringBuffer.append("Dutta"); //PramodDutta 13 | stringBuffer.append("JI"); //PramodDutta 14 | 15 | StringBuilder stringBuilder = new StringBuilder("Amit"); 16 | stringBuilder.append("Sharma"); 17 | 18 | // Thead Safty? 19 | 20 | // stringBuilder - not thread safe - people LOVE it :) 21 | 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/july/ex_27072024/Lab153.java: -------------------------------------------------------------------------------- 1 | package july.ex_27072024; 2 | 3 | public class Lab153 { 4 | public static void main(String[] args) { 5 | StringBuilder stringBuilder = new StringBuilder("Pramod"); 6 | System.out.println(stringBuilder.reverse().toString()); 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/july/ex_28072024/Animal.java: -------------------------------------------------------------------------------- 1 | package july.ex_28072024; 2 | 3 | public class Animal { 4 | String name = "LOL"; 5 | String color; 6 | 7 | 8 | void walk(){} 9 | void talk(){} 10 | 11 | public static void main(String[] args) { 12 | Animal animalrRef = null; 13 | Animal animalrRef2 = new Animal(); 14 | Animal animalrRef3 = new Animal(); 15 | Animal animalrRef4 = animalrRef2; 16 | System.out.println(animalrRef3.name); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/july/ex_28072024/Bank.java: -------------------------------------------------------------------------------- 1 | package july.ex_28072024; 2 | 3 | public class Bank { 4 | String name; 5 | int balance; 6 | 7 | 8 | void withDraw(){} 9 | void addBalance(){} 10 | } 11 | -------------------------------------------------------------------------------- /src/july/ex_28072024/BuildingBP.java: -------------------------------------------------------------------------------- 1 | package july.ex_28072024; 2 | 3 | public class BuildingBP { 4 | String color; 5 | String name; 6 | String address; 7 | int noOfRooms = 10; 8 | 9 | 10 | void useLift(){ 11 | System.out.println("i am using lift"); 12 | } 13 | 14 | void activities(){ 15 | System.out.println("i am using activites"); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/july/ex_28072024/Car.java: -------------------------------------------------------------------------------- 1 | package july.ex_28072024; 2 | 3 | public class Car { 4 | // attribute, data member, instance variable, properties 5 | Engine er; 6 | Tyre tr; 7 | 8 | // // behav / methods/ functionaities 9 | } 10 | 11 | 12 | class Engine { 13 | // attribute, data member, instance variable, properties 14 | 15 | 16 | // // behav / methods/ functionaities 17 | } 18 | 19 | class Tyre { 20 | // attribute, data member, instance variable, properties 21 | 22 | 23 | // // behav / methods/ functionaities 24 | } 25 | -------------------------------------------------------------------------------- /src/july/ex_28072024/Dog.java: -------------------------------------------------------------------------------- 1 | package july.ex_28072024; 2 | 3 | public class Dog { 4 | // Data members, properties / Attributes 5 | 6 | public String name; 7 | String breed; 8 | int age; 9 | String color; 10 | 11 | // Methods / Behaviour 12 | void walk(){} 13 | void talk(){} 14 | void sleep(){} 15 | void eat(){} 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/july/ex_28072024/Lab154.java: -------------------------------------------------------------------------------- 1 | package july.ex_28072024; 2 | 3 | public class Lab154 { 4 | public static void main(String[] args) { 5 | // OOPs - Concept 6 | // Real life problem -> OOPs concepts 7 | // Creating - New planet 8 | // AHuman 9 | // Attributes / properties -> 2 hand, eye color, node, mouth, height, wieght, body color, hair color 10 | // Behaviour / methods -> walk(), eat(), talk(), read(), sleep(), hear(). 11 | 12 | // Amit - AHuman 13 | // A -> Amit 14 | // B -> 15 | 16 | 17 | // Blueprint - Class - Person 18 | 19 | Person person = new Person(); 20 | // Real thing class -> Object 21 | person.name = "Amit"; 22 | person.rollno = 1; 23 | 24 | 25 | Person person2 = new Person(); 26 | // Real thing class -> Object 27 | person2.name = "Pramod"; 28 | person2.rollno = 2; 29 | 30 | 31 | 32 | 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/july/ex_28072024/Lab155.java: -------------------------------------------------------------------------------- 1 | package july.ex_28072024; 2 | 3 | public class Lab155 { 4 | public static void main(String[] args) { 5 | 6 | 7 | // Class - Attribute / properties - data Types - primitve or non primitive. 8 | // Class - Behaviour /Methods - functions - 9 | 10 | // object - real entity - class - 11 | // ClassName classRef = new ClassName(); 12 | 13 | // new ClassName(); - Object 14 | // classRef - Class Ref 15 | // ClassName = Class Name which blueprint you are using 16 | 17 | 18 | 19 | 20 | BuildingBP dlf = new BuildingBP(); 21 | dlf.name = "DLF Pvt Builder"; 22 | dlf.noOfRooms = 100; 23 | 24 | dlf.useLift(); 25 | 26 | 27 | BuildingBP prestige = new BuildingBP(); 28 | prestige.name = "Prestige Pvt Builder"; 29 | prestige.noOfRooms = 100; 30 | 31 | prestige.useLift(); 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/july/ex_28072024/Lab156.java: -------------------------------------------------------------------------------- 1 | package july.ex_28072024; 2 | 3 | public class Lab156 { 4 | public static void main(String[] args) { 5 | Dog dog1Ref = new Dog(); 6 | dog1Ref.name = "chow chow"; 7 | 8 | Dog dog2Ref = new Dog(); 9 | dog2Ref.name = "german shepherd"; 10 | 11 | // functions - perform a task , block of code 12 | // functions within the class are called -> methods? 13 | // class -> blueprint 14 | // object -> real entity created from the class. / instance of the class. 15 | 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/july/ex_28072024/Lab157.java: -------------------------------------------------------------------------------- 1 | package july.ex_28072024; 2 | 3 | public class Lab157 { 4 | public static void main(String[] args) { 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/july/ex_28072024/Lab158.java: -------------------------------------------------------------------------------- 1 | package july.ex_28072024; 2 | 3 | public class Lab158 { 4 | // ClassName Object_ref = Object() ->( new ClassName()) 5 | // Class -> blueprint - Attribute, Behav - Not Real ( blueprint) 6 | // Object -> Real Entities -> Class - A, Behv => functions 7 | public static void main(String[] args) { 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/july/ex_28072024/Lab159.java: -------------------------------------------------------------------------------- 1 | package july.ex_28072024; 2 | 3 | public class Lab159 { 4 | public static void main(String[] args) { 5 | Bank bank1 = new Bank(); 6 | Bank bank2 = new Bank(); 7 | 8 | bank1.name = "SBI"; 9 | bank2.name = "ICICI"; 10 | 11 | System.out.println(bank1.name); 12 | System.out.println(bank2.name); 13 | System.out.println(bank2.balance); 14 | 15 | bank2.balance = 100; 16 | System.out.println(bank2.balance); 17 | System.out.println(bank1.balance); 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/july/ex_28072024/Lab160.java: -------------------------------------------------------------------------------- 1 | package july.ex_28072024; 2 | 3 | import java.io.PrintStream; 4 | 5 | public class Lab160 { 6 | public static void main(String[] args) { 7 | System.out.println("Hello World!"); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/july/ex_28072024/Lab161.java: -------------------------------------------------------------------------------- 1 | package july.ex_28072024; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Lab161 { 6 | public static void main(String[] args) { 7 | // Create a program that determines whether a given year is a leap year. 8 | // A leap year is divisible by 4, 9 | // but not by 100 unless it is also divisible by 400. 10 | // Use an if-else statement to make this determination. 11 | 12 | // 1. Get clarity on the inputs - year -. int 2024 13 | Scanner sc = new Scanner(System.in); 14 | System.out.println("Enter the year!, I will you tell if it is leap or not leap year"); 15 | int year = sc.nextInt(); 16 | 17 | 18 | 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/july/ex_28072024/Person.java: -------------------------------------------------------------------------------- 1 | package july.ex_28072024; 2 | 3 | public class Person { 4 | 5 | // Attribute 6 | String name; 7 | int rollno; 8 | String hands; 9 | String gender; 10 | 11 | 12 | // Behavior / > Methods (function within the class) 13 | void walk() { 14 | 15 | } 16 | 17 | void talk() { 18 | } 19 | 20 | void sleep() { 21 | } 22 | 23 | void read() { 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/postman_collections/PreProd Env.postman_environment.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "50c9c5bb-2df1-4554-836e-02b2d1359fa4", 3 | "name": "PreProd Env", 4 | "values": [ 5 | { 6 | "key": "e_username", 7 | "value": "admin", 8 | "type": "default", 9 | "enabled": true 10 | }, 11 | { 12 | "key": "url", 13 | "value": "https://preprod-restful-booker.herokuapp.com", 14 | "type": "default", 15 | "enabled": true 16 | }, 17 | { 18 | "key": "username", 19 | "value": "admin", 20 | "type": "default", 21 | "enabled": true 22 | }, 23 | { 24 | "key": "password", 25 | "value": "password123", 26 | "type": "default", 27 | "enabled": true 28 | } 29 | ], 30 | "_postman_variable_scope": "environment", 31 | "_postman_exported_at": "2024-09-08T05:09:11.534Z", 32 | "_postman_exported_using": "Postman/11.11.1" 33 | } -------------------------------------------------------------------------------- /src/postman_collections/QA Env.postman_environment.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "ec7859d3-5722-4760-ab8f-9120a64eda63", 3 | "name": "QA Env", 4 | "values": [ 5 | { 6 | "key": "e_username", 7 | "value": "admin", 8 | "type": "default", 9 | "enabled": true 10 | }, 11 | { 12 | "key": "url", 13 | "value": "https://restful-booker.herokuapp.com", 14 | "type": "default", 15 | "enabled": true 16 | }, 17 | { 18 | "key": "username", 19 | "value": "admin", 20 | "type": "default", 21 | "enabled": true 22 | }, 23 | { 24 | "key": "password", 25 | "value": "password123", 26 | "type": "default", 27 | "enabled": true 28 | } 29 | ], 30 | "_postman_variable_scope": "environment", 31 | "_postman_exported_at": "2024-09-08T05:08:37.233Z", 32 | "_postman_exported_using": "Postman/11.11.1" 33 | } -------------------------------------------------------------------------------- /src/postman_collections/integration_test/QA Env.postman_environment.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "ec7859d3-5722-4760-ab8f-9120a64eda63", 3 | "name": "QA Env", 4 | "values": [ 5 | { 6 | "key": "e_username", 7 | "value": "admin", 8 | "type": "default", 9 | "enabled": true 10 | }, 11 | { 12 | "key": "url", 13 | "value": "https://restful-booker.herokuapp.com", 14 | "type": "default", 15 | "enabled": true 16 | }, 17 | { 18 | "key": "username", 19 | "value": "admin", 20 | "type": "default", 21 | "enabled": true 22 | }, 23 | { 24 | "key": "password", 25 | "value": "password123", 26 | "type": "default", 27 | "enabled": true 28 | } 29 | ], 30 | "_postman_variable_scope": "environment", 31 | "_postman_exported_at": "2024-09-08T05:08:37.233Z", 32 | "_postman_exported_using": "Postman/11.11.1" 33 | } --------------------------------------------------------------------------------