├── bin ├── day3 │ ├── Test.class │ ├── HotFut.class │ ├── Student.class │ └── DriverApp.class ├── day1 │ ├── Student.class │ ├── DriverApp.class │ ├── CallByRefDemo.class │ └── CallByValueDemo.class ├── day2 │ ├── Amitabh.class │ ├── Aradhya.class │ ├── Circle.class │ ├── Shape.class │ ├── Shweta.class │ ├── Abhishek.class │ ├── DriverApp.class │ ├── Rectangle.class │ ├── BachanFamily.class │ └── ShapeDriverApp.class ├── day6 │ ├── Student.class │ ├── HashMapDemo.class │ ├── HashMapDemo2.class │ ├── HashSetDemo.class │ ├── HashcodeDemo.class │ ├── IteratorDemo.class │ ├── TreeSetDemo.class │ ├── TreeSetDemo2.class │ ├── TreeSetDemo3.class │ ├── ArrayListDemo.class │ ├── ArrayListDemo2.class │ ├── CloneableDemo.class │ ├── RnoComparator.class │ ├── SnameComparator.class │ ├── Sum2ProblemArray.class │ ├── GroupWordsByLength.class │ ├── CollectionMethodsDemo.class │ ├── GroupWordsByAnagrams.class │ ├── PercentageComparator.class │ ├── FirstRepeatingCharInAString.class │ └── FirstNonRepeatingCharInAString.class ├── day7 │ ├── ERRORS.class │ ├── Planet.class │ ├── Student.class │ ├── ByteDemo.class │ ├── EnumDriver.class │ ├── LoginDriver.class │ └── StudentDriver.class ├── day4 │ ├── CheckedDemo.class │ ├── NestedTryDemo.class │ ├── UncheckedDemo.class │ ├── LowQuantityException.class │ └── UserDefinedExceptionDemo.class ├── day5 │ ├── StringTypes.class │ ├── ThrowsKeywordDemo.class │ ├── IntegerCountFromString.class │ ├── StatementPriorityDemo.class │ └── ExceptionInterviewQuestion.class ├── day8 │ ├── CreateTable.class │ ├── ReadUsingStatement.class │ ├── DeleteUsingStatement.class │ ├── InsertUsingStatement.class │ ├── MySQLDatabaseConnectionKIIT.class │ ├── DeleteUsingPreparedStatement.class │ ├── InsertUsingPreparedStatement.class │ ├── UpdateUsingPreparedStatement.class │ └── InsertUsingPreparedStatementBatch.class └── day3hotfutsolution │ ├── Turf.class │ ├── DriverApp.class │ ├── TennisTurf.class │ ├── CricketTurf.class │ ├── FootballTurf.class │ ├── SkatingTurf.class │ └── TurfFactory.class ├── src ├── day2 │ ├── Shweta.java │ ├── Shape.java │ ├── ShapeDriverApp.java │ ├── BachanFamily.java │ ├── Amitabh.java │ ├── Circle.java │ ├── Aradhya.java │ ├── Rectangle.java │ ├── Abhishek.java │ └── DriverApp.java ├── day3hotfutsolution │ ├── Turf.java │ ├── SkatingTurf.java │ ├── FootballTurf.java │ ├── TennisTurf.java │ ├── CricketTurf.java │ ├── TurfFactory.java │ └── DriverApp.java ├── day7 │ ├── StudentDriver.java │ ├── ByteDemo.java │ ├── EnumDriver.java │ ├── LoginDriver.java │ ├── Planet.java │ ├── ERRORS.java │ └── Student.java ├── day6 │ ├── HashcodeDemo.java │ ├── SnameComparator.java │ ├── RnoComparator.java │ ├── PercentageComparator.java │ ├── CloneableDemo.java │ ├── TreeSetDemo3.java │ ├── Sum2ProblemArray.java │ ├── FirstRepeatingCharInAString.java │ ├── FirstNonRepeatingCharInAString.java │ ├── HashMapDemo.java │ ├── GroupWordsByLength.java │ ├── ArrayListDemo.java │ ├── GroupWordsByAnagrams.java │ ├── IteratorDemo.java │ ├── TreeSetDemo.java │ ├── TreeSetDemo2.java │ ├── HashMapDemo2.java │ ├── HashSetDemo.java │ ├── ArrayListDemo2.java │ ├── CollectionMethodsDemo.java │ └── Student.java ├── day4 │ ├── LowQuantityException.java │ ├── UserDefinedExceptionDemo.java │ ├── CheckedDemo.java │ ├── NestedTryDemo.java │ └── UncheckedDemo.java ├── day1 │ ├── DriverApp.java │ ├── CallByValueDemo.java │ ├── CallByRefDemo.java │ └── Student.java ├── day3 │ ├── DriverApp.java │ ├── Test.java │ ├── HotFut.java │ └── Student.java ├── day5 │ ├── StringTypes.java │ ├── StatementPriorityDemo.java │ ├── ExceptionInterviewQuestion.java │ ├── IntegerCountFromString.java │ └── ThrowsKeywordDemo.java └── day8 │ ├── MySQLDatabaseConnectionKIIT.java │ ├── DeleteUsingStatement.java │ ├── ReadUsingStatement.java │ ├── CreateTable.java │ ├── DeleteUsingPreparedStatement.java │ ├── InsertUsingPreparedStatement.java │ ├── UpdateUsingPreparedStatement.java │ ├── InsertUsingStatement.java │ └── InsertUsingPreparedStatementBatch.java ├── .settings ├── org.eclipse.core.resources.prefs └── org.eclipse.jdt.core.prefs ├── PaintDiagrams └── collections │ ├── slide1.png │ ├── slide2.png │ ├── slide3.png │ └── slide4.png ├── .classpath └── .project /bin/day3/Test.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day3/Test.class -------------------------------------------------------------------------------- /src/day2/Shweta.java: -------------------------------------------------------------------------------- 1 | package day2; 2 | 3 | public class Shweta extends Amitabh 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /bin/day1/Student.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day1/Student.class -------------------------------------------------------------------------------- /bin/day2/Amitabh.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day2/Amitabh.class -------------------------------------------------------------------------------- /bin/day2/Aradhya.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day2/Aradhya.class -------------------------------------------------------------------------------- /bin/day2/Circle.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day2/Circle.class -------------------------------------------------------------------------------- /bin/day2/Shape.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day2/Shape.class -------------------------------------------------------------------------------- /bin/day2/Shweta.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day2/Shweta.class -------------------------------------------------------------------------------- /bin/day3/HotFut.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day3/HotFut.class -------------------------------------------------------------------------------- /bin/day3/Student.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day3/Student.class -------------------------------------------------------------------------------- /bin/day6/Student.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day6/Student.class -------------------------------------------------------------------------------- /bin/day7/ERRORS.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day7/ERRORS.class -------------------------------------------------------------------------------- /bin/day7/Planet.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day7/Planet.class -------------------------------------------------------------------------------- /bin/day7/Student.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day7/Student.class -------------------------------------------------------------------------------- /bin/day1/DriverApp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day1/DriverApp.class -------------------------------------------------------------------------------- /bin/day2/Abhishek.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day2/Abhishek.class -------------------------------------------------------------------------------- /bin/day2/DriverApp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day2/DriverApp.class -------------------------------------------------------------------------------- /bin/day2/Rectangle.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day2/Rectangle.class -------------------------------------------------------------------------------- /bin/day3/DriverApp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day3/DriverApp.class -------------------------------------------------------------------------------- /bin/day7/ByteDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day7/ByteDemo.class -------------------------------------------------------------------------------- /bin/day2/BachanFamily.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day2/BachanFamily.class -------------------------------------------------------------------------------- /bin/day4/CheckedDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day4/CheckedDemo.class -------------------------------------------------------------------------------- /bin/day5/StringTypes.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day5/StringTypes.class -------------------------------------------------------------------------------- /bin/day6/HashMapDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day6/HashMapDemo.class -------------------------------------------------------------------------------- /bin/day6/HashMapDemo2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day6/HashMapDemo2.class -------------------------------------------------------------------------------- /bin/day6/HashSetDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day6/HashSetDemo.class -------------------------------------------------------------------------------- /bin/day6/HashcodeDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day6/HashcodeDemo.class -------------------------------------------------------------------------------- /bin/day6/IteratorDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day6/IteratorDemo.class -------------------------------------------------------------------------------- /bin/day6/TreeSetDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day6/TreeSetDemo.class -------------------------------------------------------------------------------- /bin/day6/TreeSetDemo2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day6/TreeSetDemo2.class -------------------------------------------------------------------------------- /bin/day6/TreeSetDemo3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day6/TreeSetDemo3.class -------------------------------------------------------------------------------- /bin/day7/EnumDriver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day7/EnumDriver.class -------------------------------------------------------------------------------- /bin/day7/LoginDriver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day7/LoginDriver.class -------------------------------------------------------------------------------- /bin/day8/CreateTable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day8/CreateTable.class -------------------------------------------------------------------------------- /bin/day1/CallByRefDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day1/CallByRefDemo.class -------------------------------------------------------------------------------- /bin/day2/ShapeDriverApp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day2/ShapeDriverApp.class -------------------------------------------------------------------------------- /bin/day4/NestedTryDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day4/NestedTryDemo.class -------------------------------------------------------------------------------- /bin/day4/UncheckedDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day4/UncheckedDemo.class -------------------------------------------------------------------------------- /bin/day6/ArrayListDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day6/ArrayListDemo.class -------------------------------------------------------------------------------- /bin/day6/ArrayListDemo2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day6/ArrayListDemo2.class -------------------------------------------------------------------------------- /bin/day6/CloneableDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day6/CloneableDemo.class -------------------------------------------------------------------------------- /bin/day6/RnoComparator.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day6/RnoComparator.class -------------------------------------------------------------------------------- /bin/day7/StudentDriver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day7/StudentDriver.class -------------------------------------------------------------------------------- /bin/day1/CallByValueDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day1/CallByValueDemo.class -------------------------------------------------------------------------------- /bin/day5/ThrowsKeywordDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day5/ThrowsKeywordDemo.class -------------------------------------------------------------------------------- /bin/day6/SnameComparator.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day6/SnameComparator.class -------------------------------------------------------------------------------- /bin/day6/Sum2ProblemArray.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day6/Sum2ProblemArray.class -------------------------------------------------------------------------------- /bin/day3hotfutsolution/Turf.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day3hotfutsolution/Turf.class -------------------------------------------------------------------------------- /bin/day6/GroupWordsByLength.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day6/GroupWordsByLength.class -------------------------------------------------------------------------------- /bin/day8/ReadUsingStatement.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day8/ReadUsingStatement.class -------------------------------------------------------------------------------- /PaintDiagrams/collections/slide1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/PaintDiagrams/collections/slide1.png -------------------------------------------------------------------------------- /PaintDiagrams/collections/slide2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/PaintDiagrams/collections/slide2.png -------------------------------------------------------------------------------- /PaintDiagrams/collections/slide3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/PaintDiagrams/collections/slide3.png -------------------------------------------------------------------------------- /PaintDiagrams/collections/slide4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/PaintDiagrams/collections/slide4.png -------------------------------------------------------------------------------- /bin/day4/LowQuantityException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day4/LowQuantityException.class -------------------------------------------------------------------------------- /bin/day5/IntegerCountFromString.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day5/IntegerCountFromString.class -------------------------------------------------------------------------------- /bin/day5/StatementPriorityDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day5/StatementPriorityDemo.class -------------------------------------------------------------------------------- /bin/day6/CollectionMethodsDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day6/CollectionMethodsDemo.class -------------------------------------------------------------------------------- /bin/day6/GroupWordsByAnagrams.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day6/GroupWordsByAnagrams.class -------------------------------------------------------------------------------- /bin/day6/PercentageComparator.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day6/PercentageComparator.class -------------------------------------------------------------------------------- /bin/day8/DeleteUsingStatement.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day8/DeleteUsingStatement.class -------------------------------------------------------------------------------- /bin/day8/InsertUsingStatement.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day8/InsertUsingStatement.class -------------------------------------------------------------------------------- /bin/day3hotfutsolution/DriverApp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day3hotfutsolution/DriverApp.class -------------------------------------------------------------------------------- /bin/day3hotfutsolution/TennisTurf.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day3hotfutsolution/TennisTurf.class -------------------------------------------------------------------------------- /bin/day4/UserDefinedExceptionDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day4/UserDefinedExceptionDemo.class -------------------------------------------------------------------------------- /bin/day3hotfutsolution/CricketTurf.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day3hotfutsolution/CricketTurf.class -------------------------------------------------------------------------------- /bin/day3hotfutsolution/FootballTurf.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day3hotfutsolution/FootballTurf.class -------------------------------------------------------------------------------- /bin/day3hotfutsolution/SkatingTurf.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day3hotfutsolution/SkatingTurf.class -------------------------------------------------------------------------------- /bin/day3hotfutsolution/TurfFactory.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day3hotfutsolution/TurfFactory.class -------------------------------------------------------------------------------- /bin/day5/ExceptionInterviewQuestion.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day5/ExceptionInterviewQuestion.class -------------------------------------------------------------------------------- /bin/day6/FirstRepeatingCharInAString.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day6/FirstRepeatingCharInAString.class -------------------------------------------------------------------------------- /bin/day8/MySQLDatabaseConnectionKIIT.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day8/MySQLDatabaseConnectionKIIT.class -------------------------------------------------------------------------------- /bin/day8/DeleteUsingPreparedStatement.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day8/DeleteUsingPreparedStatement.class -------------------------------------------------------------------------------- /bin/day8/InsertUsingPreparedStatement.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day8/InsertUsingPreparedStatement.class -------------------------------------------------------------------------------- /bin/day8/UpdateUsingPreparedStatement.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day8/UpdateUsingPreparedStatement.class -------------------------------------------------------------------------------- /bin/day6/FirstNonRepeatingCharInAString.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day6/FirstNonRepeatingCharInAString.class -------------------------------------------------------------------------------- /bin/day8/InsertUsingPreparedStatementBatch.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uysolanki/KIIT-FSD-June-2025/HEAD/bin/day8/InsertUsingPreparedStatementBatch.class -------------------------------------------------------------------------------- /src/day3hotfutsolution/Turf.java: -------------------------------------------------------------------------------- 1 | package day3hotfutsolution; 2 | 3 | public interface Turf { 4 | double getTurfPrice(); 5 | String getTurfType(); 6 | } 7 | -------------------------------------------------------------------------------- /src/day7/StudentDriver.java: -------------------------------------------------------------------------------- 1 | package day7; 2 | 3 | public class StudentDriver { 4 | 5 | public static void main(String[] args) { 6 | 7 | 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/day7/ByteDemo.java: -------------------------------------------------------------------------------- 1 | package day7; 2 | 3 | public class ByteDemo { 4 | 5 | public static void main(String[] args) { 6 | byte b; 7 | 8 | b=-128; 9 | b=127; 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/day2/Shape.java: -------------------------------------------------------------------------------- 1 | package day2; 2 | 3 | public interface Shape { 4 | static final double PI=3.14; 5 | void area(); 6 | void perimeter(); 7 | default void shapeDimension() 8 | { 9 | System.out.println("2D"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/day6/HashcodeDemo.java: -------------------------------------------------------------------------------- 1 | package day6; 2 | 3 | public class HashcodeDemo { 4 | 5 | public static void main(String[] args) { 6 | 7 | String name="Alice"; 8 | 9 | System.out.println( name.hashCode()); 10 | 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/day2/ShapeDriverApp.java: -------------------------------------------------------------------------------- 1 | package day2; 2 | 3 | public class ShapeDriverApp { 4 | 5 | public static void main(String[] args) { 6 | Shape shape=new Circle(); 7 | shape.area(); 8 | shape.perimeter(); 9 | shape.shapeDimension(); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/day2/BachanFamily.java: -------------------------------------------------------------------------------- 1 | package day2; 2 | 3 | public interface BachanFamily { 4 | 5 | public abstract void home(); 6 | default void car() {System.out.println("Family Car");} 7 | default void office() {System.out.println("Family Office");} 8 | void gold(); 9 | } 10 | -------------------------------------------------------------------------------- /src/day4/LowQuantityException.java: -------------------------------------------------------------------------------- 1 | package day4; 2 | 3 | public class LowQuantityException extends RuntimeException // LowQuantityException will become unchecked 4 | { 5 | public LowQuantityException(String errorMessage) 6 | { 7 | super(errorMessage); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/day6/SnameComparator.java: -------------------------------------------------------------------------------- 1 | package day6; 2 | 3 | import java.util.Comparator; 4 | 5 | public class SnameComparator implements Comparator 6 | { 7 | 8 | @Override 9 | public int compare(Student s1, Student s2) { 10 | return s1.getSname().compareTo(s2.getSname()); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/day3hotfutsolution/SkatingTurf.java: -------------------------------------------------------------------------------- 1 | package day3hotfutsolution; 2 | 3 | public class SkatingTurf implements Turf 4 | { 5 | 6 | @Override 7 | public double getTurfPrice() { 8 | return 2500; 9 | } 10 | 11 | @Override 12 | public String getTurfType() { 13 | return "Skating Turf"; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/day2/Amitabh.java: -------------------------------------------------------------------------------- 1 | package day2; 2 | 3 | public class Amitabh implements BachanFamily 4 | { 5 | 6 | String qualification="MCOM"; 7 | 8 | public void home() 9 | { 10 | System.out.println("Jalsa"); 11 | } 12 | 13 | 14 | public final void gold() 15 | { 16 | System.out.println("Tanishq"); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/day3hotfutsolution/FootballTurf.java: -------------------------------------------------------------------------------- 1 | package day3hotfutsolution; 2 | 3 | public class FootballTurf implements Turf 4 | { 5 | @Override 6 | public double getTurfPrice() { 7 | return 1000; 8 | } 9 | 10 | @Override 11 | public String getTurfType() { 12 | // TODO Auto-generated method stub 13 | return "Football Turf"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/day3hotfutsolution/TennisTurf.java: -------------------------------------------------------------------------------- 1 | package day3hotfutsolution; 2 | 3 | public class TennisTurf implements Turf 4 | { 5 | @Override 6 | public double getTurfPrice() { 7 | return 1500; 8 | } 9 | 10 | @Override 11 | public String getTurfType() { 12 | // TODO Auto-generated method stub 13 | return "Tennis Turf"; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/day3hotfutsolution/CricketTurf.java: -------------------------------------------------------------------------------- 1 | package day3hotfutsolution; 2 | 3 | public class CricketTurf implements Turf 4 | { 5 | 6 | @Override 7 | public double getTurfPrice() { 8 | return 700; 9 | } 10 | 11 | @Override 12 | public String getTurfType() { 13 | // TODO Auto-generated method stub 14 | return "Cricket Turf"; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/day1/DriverApp.java: -------------------------------------------------------------------------------- 1 | package day1; 2 | 3 | public class DriverApp { 4 | 5 | public static void main(String args[]) 6 | { 7 | //LHS RHS 8 | Student s1 = new Student(); 9 | s1.acceptStudent(); 10 | s1.displayStudent(); 11 | 12 | System.out.println(s1.getRno()); //read getter 13 | s1.setRno(45); //write setter 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/day2/Circle.java: -------------------------------------------------------------------------------- 1 | package day2; 2 | 3 | public class Circle implements Shape 4 | { 5 | @Override 6 | public void area() { 7 | double result=PI*5*5; 8 | System.out.println("Area of Circle is "+result); 9 | 10 | } 11 | @Override 12 | public void perimeter() { 13 | double result=2*PI*5; 14 | System.out.println("Perimeter of Circle is "+result); 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/day6/RnoComparator.java: -------------------------------------------------------------------------------- 1 | package day6; 2 | 3 | import java.util.Comparator; 4 | 5 | public class RnoComparator implements Comparator 6 | { 7 | 8 | @Override 9 | public int compare(Student s1, Student s2) { 10 | if(s1.getRno()>s2.getRno()) 11 | return 1; 12 | else if(s1.getRno() 6 | { 7 | 8 | @Override 9 | public int compare(Student s1, Student s2) { 10 | if(s1.getPer()>s2.getPer()) 11 | return -1; 12 | else if(s1.getPer() 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/day1/CallByValueDemo.java: -------------------------------------------------------------------------------- 1 | package day1; 2 | 3 | public class CallByValueDemo { 4 | 5 | public static void main(String[] args) { 6 | int a=10; 7 | System.out.println("A : "+a);//10 8 | test(a); 9 | System.out.println("A : "+a);//10 10 | } 11 | 12 | private static void test(int z) { 13 | System.out.println("Z : "+z);//10 14 | z=99; 15 | System.out.println("Z : "+z);//99 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/day2/Rectangle.java: -------------------------------------------------------------------------------- 1 | package day2; 2 | 3 | public class Rectangle implements Shape 4 | { 5 | 6 | @Override 7 | public void area() { 8 | double result=5*10; 9 | System.out.println("Area of Rectangle is "+result); 10 | 11 | } 12 | 13 | @Override 14 | public void perimeter() { 15 | double result=2*(5+10); 16 | System.out.println("Perimeter of Rectangle is "+result); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/day7/EnumDriver.java: -------------------------------------------------------------------------------- 1 | package day7; 2 | 3 | public class EnumDriver { 4 | 5 | public static void main(String[] args) { 6 | Planet planet; 7 | 8 | planet=Planet.EARTH; 9 | 10 | System.out.println("Gravity of " + planet + " is " +planet.calculateGravity()); 11 | 12 | planet=Planet.JUPITER; 13 | System.out.println("Gravity of " + planet + " is " +planet.calculateGravity()); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/day3/DriverApp.java: -------------------------------------------------------------------------------- 1 | package day3; 2 | 3 | public class DriverApp { 4 | 5 | public static void main(String[] args) { 6 | 7 | Student.displayPrincipalName(); 8 | 9 | Student s1=new Student(); 10 | s1.displayStudent(); 11 | 12 | 13 | 14 | int a=0; 15 | String b=null; 16 | double c=0.0; 17 | 18 | System.out.println(a); 19 | System.out.println(b); 20 | System.out.println(c); 21 | 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | KIITCorporateTraining 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/day2/Abhishek.java: -------------------------------------------------------------------------------- 1 | package day2; 2 | 3 | public class Abhishek extends Amitabh 4 | { 5 | String qualification="BCOM"; 6 | String spouseName="Aishwarya"; 7 | 8 | @Override 9 | public void home() 10 | { 11 | System.out.println("new Jalsa"); 12 | } 13 | 14 | // @Override 15 | // void gold() { 16 | // System.out.println("Ranka Jewellers"); 17 | // } 18 | 19 | public void car() 20 | { 21 | System.out.println("Audi"); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/day3hotfutsolution/TurfFactory.java: -------------------------------------------------------------------------------- 1 | package day3hotfutsolution; 2 | 3 | public class TurfFactory { 4 | 5 | static Turf turf; 6 | 7 | public static Turf getTurf(int turfChoice) 8 | { 9 | switch(turfChoice) 10 | { 11 | case 1: turf= new CricketTurf(); break; 12 | case 2: turf= new FootballTurf(); break; 13 | case 3: turf= new TennisTurf(); break; 14 | case 4: turf= new SkatingTurf(); break; 15 | } 16 | return turf; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/day6/CloneableDemo.java: -------------------------------------------------------------------------------- 1 | package day6; 2 | 3 | public class CloneableDemo { 4 | 5 | public static void main(String[] args) throws CloneNotSupportedException { 6 | Student s4=new Student(18,"Virat",78.5); 7 | Student s5=(Student)s4.clone(); //not having the I card, the flag is not set 8 | 9 | s4.setRno(45); 10 | 11 | System.out.println("S4 " +s4.getRno()); // S4 45 12 | System.out.println("S5 " +s5.getRno()); // S5 18 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/day3/Test.java: -------------------------------------------------------------------------------- 1 | package day3; 2 | import static java.lang.Math.*; 3 | public class Test { 4 | 5 | static { 6 | System.out.print("Congratulations, "); 7 | } 8 | 9 | public static void main(String[] args) { 10 | System.out.println("Virat"); 11 | double area=PI*5*5; 12 | System.out.println(area); 13 | 14 | 15 | int yob=2000; 16 | int current_year=2025; 17 | 18 | int age=abs(yob-current_year); 19 | System.out.println("Your age is " +age); 20 | 21 | System.out.println(log10(100)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/day1/CallByRefDemo.java: -------------------------------------------------------------------------------- 1 | package day1; 2 | 3 | public class CallByRefDemo { 4 | 5 | public static void main(String[] args) { 6 | //int arr[]= {10,20}; 7 | Student s1=new Student(); 8 | s1.setRno(18); 9 | s1.setSname("Virat"); 10 | s1.setPer(78.5); 11 | 12 | System.out.println("A : "+s1.getRno());//18 13 | test(s1); 14 | System.out.println("A : "+s1.getRno());//96 15 | } 16 | 17 | private static void test(Student sz) { 18 | System.out.println("Z : "+sz.getRno());//18 19 | sz.setRno(96); 20 | System.out.println("Z : "+sz.getRno());//96 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/day5/StringTypes.java: -------------------------------------------------------------------------------- 1 | package day5; 2 | 3 | public class StringTypes { 4 | public static void main(String[] args) { 5 | String s1 = "123"; //Numeric String 6 | String s2 = "456"; 7 | // 579 8 | String s3 = "123abc"; 9 | 10 | int n1=Integer.parseInt(s1); 11 | int n2=Integer.parseInt(s2); 12 | int n3=Integer.parseInt(s3); //NumberFormatException 13 | 14 | System.out.println(n1+n2); //123456 15 | } 16 | } 17 | //"my name is Alice i am 19 years old i have 2 brothers and 1 sister" 18 | //can you display the count of integers 19 | //output : Integer count 3 -------------------------------------------------------------------------------- /src/day5/StatementPriorityDemo.java: -------------------------------------------------------------------------------- 1 | package day5; 2 | 3 | public class StatementPriorityDemo { 4 | 5 | public static void main(String[] args) { 6 | 7 | System.out.println(test()); 8 | 9 | } 10 | 11 | private static int test() { 12 | int numerator=100; 13 | int denominators[]= {10,20,0,50}; 14 | int result=0; 15 | for(int i=0;i arr =new ArrayList(Arrays.asList(10,20,30,40,50)); 11 | int sum=90; 12 | for(int num1:arr) //num1 num2 13 | { //10 80 14 | int num2=sum-num1; //20 70 15 | if(arr.contains(num2)) //30 60 16 | { //40 50 17 | System.out.println("[" + num1 + ","+ num2 + "]"); 18 | break; 19 | } 20 | } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/day8/MySQLDatabaseConnectionKIIT.java: -------------------------------------------------------------------------------- 1 | //utility classes 2 | package day8; 3 | 4 | import java.sql.Connection; 5 | import java.sql.DriverManager; 6 | import java.sql.SQLException; 7 | 8 | public class MySQLDatabaseConnectionKIIT { 9 | 10 | static Connection con=null; 11 | static String dbName="jdbc:mysql://localhost:3306/kiitdb"; 12 | static String userName="root"; 13 | static String password=""; 14 | 15 | public static Connection getDBConnection() throws SQLException, ClassNotFoundException 16 | { 17 | Class.forName("com.mysql.jdbc.Driver"); 18 | Connection con = DriverManager.getConnection(dbName, userName,""); 19 | return con; 20 | } 21 | } -------------------------------------------------------------------------------- /src/day5/ExceptionInterviewQuestion.java: -------------------------------------------------------------------------------- 1 | package day5; 2 | 3 | public class ExceptionInterviewQuestion { 4 | 5 | public static void main(String[] args) { 6 | 7 | int result=test(); 8 | System.out.println(result); 9 | 10 | } 11 | 12 | private static int test() { 13 | try 14 | { 15 | int ans=10/0; 16 | return 1; 17 | } 18 | catch(ArithmeticException e1) 19 | { 20 | return 2; 21 | } 22 | finally 23 | { 24 | return 3; 25 | } 26 | } 27 | 28 | } 29 | //if the code has gone into try it will go into catch is conditional to occurance of an exception 30 | //if the code has gone into try it HAS TO go into finally irresopective exception occurs or not -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.release=enabled 12 | org.eclipse.jdt.core.compiler.source=1.8 13 | -------------------------------------------------------------------------------- /src/day7/LoginDriver.java: -------------------------------------------------------------------------------- 1 | package day7; 2 | 3 | import java.util.Scanner; 4 | 5 | public class LoginDriver { 6 | 7 | public static void main(String[] args) { 8 | Scanner sc=new Scanner(System.in); 9 | System.out.println("Enter Username"); 10 | String username=sc.next(); 11 | 12 | System.out.println("Enter Password"); 13 | String password=sc.next(); 14 | 15 | ERRORS error; 16 | if(username.length()<3) 17 | { 18 | error=ERRORS.ERROR1; 19 | System.out.println(String.format(error.getErrorMessage(), username)); 20 | } 21 | 22 | if(password.length()<8) 23 | { 24 | error=ERRORS.ERROR2; 25 | System.out.println(error.getErrorMessage()); 26 | } 27 | 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/day8/DeleteUsingStatement.java: -------------------------------------------------------------------------------- 1 | package day8; 2 | 3 | import java.sql.Connection; 4 | import java.sql.SQLException; 5 | import java.sql.Statement; 6 | 7 | public class DeleteUsingStatement { 8 | 9 | public static void main(String[] args) throws ClassNotFoundException, SQLException { 10 | 11 | Connection con=MySQLDatabaseConnectionKIIT.getDBConnection(); 12 | 13 | Statement st=con.createStatement(); 14 | String query="delete from emp where eno=107"; 15 | 16 | int rows=st.executeUpdate(query); 17 | 18 | if(rows>0) 19 | System.out.println(rows +"Records Deleted"); 20 | else 21 | System.out.println("Error In Deletion"); 22 | 23 | st.close(); 24 | con.close(); 25 | 26 | } 27 | 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/day5/IntegerCountFromString.java: -------------------------------------------------------------------------------- 1 | package day5; 2 | 3 | import java.util.Arrays; 4 | 5 | public class IntegerCountFromString { 6 | 7 | public static void main(String[] args) { 8 | String sentance="my name is Alice i am 19 years old i have 2 brothers and 1 sister"; 9 | System.out.println(sentance); 10 | String words[]=sentance.split(" "); 11 | System.out.println(Arrays.toString(words)); 12 | System.out.print("Integers Found Are : "); 13 | int count=0; 14 | for(String word:words) 15 | { 16 | try 17 | { 18 | int n=Integer.parseInt(word); 19 | System.out.print(n+ ","); 20 | count++; 21 | } 22 | catch(NumberFormatException e1) {} 23 | } 24 | 25 | System.out.println("\nTotal Integers "+count); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/day7/Planet.java: -------------------------------------------------------------------------------- 1 | package day7; 2 | 3 | public enum Planet { 4 | MERCURY(5.0,100.0), 5 | VENUS(6.0,200.0), 6 | EARTH(7,300.0), 7 | MARS(3,200), 8 | JUPITER(13,2000), 9 | SATURN(8,1200), 10 | URANUS(4,500), 11 | NEPTUNE(3,250); 12 | 13 | private double radius; 14 | private double mass; 15 | 16 | private Planet(double radius, double mass) { 17 | this.radius = radius; 18 | this.mass = mass; 19 | } 20 | 21 | public double getRadius() { 22 | return radius; 23 | } 24 | 25 | public void setRadius(double radius) { 26 | this.radius = radius; 27 | } 28 | 29 | public double getMass() { 30 | return mass; 31 | } 32 | 33 | public void setMass(double mass) { 34 | this.mass = mass; 35 | } 36 | 37 | double calculateGravity() 38 | { 39 | return this.mass/(this.radius*this.radius); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/day6/FirstRepeatingCharInAString.java: -------------------------------------------------------------------------------- 1 | package day6; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class FirstRepeatingCharInAString { 7 | public static void main(String[] args) { 8 | String input="M$ah$endra Singh Dhoni"; //output i; 9 | input =input.replaceAll("[^a-zA-Z0-9]", "").toLowerCase(); 10 | System.out.println(input); 11 | //step1 : display count of occurances of a char in a String : v:1,i:2,r:1,a:1,t:1... 12 | Map counter=new HashMap(); 13 | for(char c: input.toCharArray()) 14 | { 15 | counter.put(c, counter.getOrDefault(c, 0)+1); 16 | } 17 | 18 | //System.out.println(counter); 19 | for(char c: input.toCharArray()) 20 | { 21 | if(counter.get(c)>1) 22 | { 23 | System.out.println(c); 24 | break; 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/day6/FirstNonRepeatingCharInAString.java: -------------------------------------------------------------------------------- 1 | package day6; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class FirstNonRepeatingCharInAString { 7 | public static void main(String[] args) { 8 | String input="M$ah$endra Singh Dhomi"; //output i; 9 | input =input.replaceAll("[^a-zA-Z0-9]", "").toLowerCase(); 10 | System.out.println(input); 11 | //step1 : display count of occurances of a char in a String : v:1,i:2,r:1,a:1,t:1... 12 | Map counter=new HashMap(); 13 | for(char c: input.toCharArray()) 14 | { 15 | counter.put(c, counter.getOrDefault(c, 0)+1); 16 | } 17 | 18 | System.out.println(counter); 19 | for(char c: input.toCharArray()) 20 | { 21 | if(counter.get(c)==1) 22 | { 23 | System.out.println(c); 24 | break; 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/day8/ReadUsingStatement.java: -------------------------------------------------------------------------------- 1 | package day8; 2 | 3 | import java.sql.Connection; 4 | import java.sql.ResultSet; 5 | import java.sql.SQLException; 6 | import java.sql.Statement; 7 | 8 | public class ReadUsingStatement { 9 | public static void main(String[] args) throws ClassNotFoundException, SQLException { 10 | 11 | Connection con=MySQLDatabaseConnectionKIIT.getDBConnection(); 12 | 13 | Statement st=con.createStatement(); 14 | String query="select sal,ename from emp where sal>=900"; 15 | 16 | ResultSet rs=st.executeQuery(query); 17 | System.out.println(String.format("%-15s %-15s", "Emp Name","Emp Salary")); 18 | while(rs.next()) 19 | { 20 | System.out.println(String.format("%-15s %.3f", rs.getString("ename"),rs.getDouble("sal"))); 21 | } 22 | } 23 | } 24 | 25 | /* 26 | --------------- 27 | 28 | Ben 29 | */ -------------------------------------------------------------------------------- /src/day8/CreateTable.java: -------------------------------------------------------------------------------- 1 | package day8; 2 | 3 | import java.sql.Connection; 4 | import java.sql.DriverManager; 5 | import java.sql.SQLException; 6 | import java.sql.Statement; 7 | 8 | public class CreateTable { 9 | 10 | public static void main(String[] args) throws ClassNotFoundException,SQLException 11 | { 12 | //Class.forName("com.mysql.cj.jdbc.Driver"); version 8 13 | 14 | Class.forName("com.mysql.jdbc.Driver"); //version 8 15 | Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/kiitdb","root",""); 16 | 17 | Statement st=con.createStatement(); 18 | String query="create table emp(\r\n" 19 | + "eno int(5) primary key,\r\n" 20 | + "ename varchar(10),\r\n" 21 | + "sal decimal(5,2))"; 22 | 23 | st.execute(query); 24 | 25 | System.out.println("Table Created"); 26 | 27 | st.close(); 28 | con.close(); 29 | 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/day7/ERRORS.java: -------------------------------------------------------------------------------- 1 | package day7; 2 | 3 | public enum ERRORS { 4 | 5 | ERROR1("ERR-1","%s is an Invalid Username"), 6 | ERROR2("ERR-2","Invalid Password"), 7 | ERROR3("Invalid Password"), 8 | ERROR235("ERR-235","Customised Message"); 9 | //100's of entries 10 | 11 | private String errorId; 12 | private String errorMessage; 13 | 14 | private ERRORS(String errorId, String errorMessage) { 15 | this.errorId = errorId; 16 | this.errorMessage = errorMessage; 17 | } 18 | 19 | private ERRORS(String errorMessage) { 20 | this.errorMessage = errorMessage; 21 | } 22 | 23 | 24 | public String getErrorId() { 25 | return errorId; 26 | } 27 | 28 | public void setErrorId(String errorId) { 29 | this.errorId = errorId; 30 | } 31 | 32 | public String getErrorMessage() { 33 | return errorMessage; 34 | } 35 | 36 | public void setErrorMessage(String errorMessage) { 37 | this.errorMessage = errorMessage; 38 | } 39 | 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/day8/DeleteUsingPreparedStatement.java: -------------------------------------------------------------------------------- 1 | package day8; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.SQLException; 6 | import java.sql.Statement; 7 | import java.util.Scanner; 8 | 9 | public class DeleteUsingPreparedStatement { 10 | 11 | public static void main(String[] args) throws ClassNotFoundException, SQLException { 12 | Connection con=MySQLDatabaseConnectionKIIT.getDBConnection(); 13 | 14 | Scanner sc=new Scanner(System.in); 15 | 16 | System.out.println("Enter Employee Number"); 17 | int a=sc.nextInt(); 18 | 19 | String query="delete from emp where eno=?"; 20 | 21 | PreparedStatement ps=con.prepareStatement(query); 22 | 23 | ps.setInt(1, a); 24 | 25 | int rows=ps.executeUpdate(); 26 | 27 | if(rows>0) 28 | System.out.println(rows +"Records Deleted"); 29 | else 30 | System.out.println("Error In Deletion"); 31 | 32 | ps.close(); 33 | con.close(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/day4/UserDefinedExceptionDemo.java: -------------------------------------------------------------------------------- 1 | package day4; 2 | 3 | import java.util.InputMismatchException; 4 | import java.util.Scanner; 5 | 6 | public class UserDefinedExceptionDemo { 7 | 8 | public static void main(String[] args) { 9 | Scanner sc=new Scanner(System.in); 10 | try 11 | { 12 | System.out.println("Enter Ordered Quantity"); //300 13 | int quantity=sc.nextInt(); 14 | 15 | if(quantity>=500) 16 | System.out.println("Order Accepted"); 17 | else 18 | throw new ArithmeticException("Please enter qty > 500");//throw is used in conjuction with custom exception 19 | } 20 | catch(InputMismatchException e1) 21 | { 22 | System.out.println("Please enter valid integer value"); 23 | } 24 | catch(ArithmeticException e2) 25 | { 26 | System.out.println(e2.getMessage()); // / by zero 27 | } 28 | finally 29 | { 30 | System.out.println("Thank You!! Visit Again"); 31 | } 32 | 33 | } 34 | } 35 | /*virat vi rat 36 | InvalidNameException*/ -------------------------------------------------------------------------------- /src/day2/DriverApp.java: -------------------------------------------------------------------------------- 1 | package day2; 2 | 3 | public class DriverApp { 4 | 5 | public static void main(String[] args) { 6 | Amitabh a1; 7 | Abhishek a2; 8 | Aradhya a3; 9 | a1=new Aradhya(); 10 | a2=new Aradhya(); 11 | a3=new Aradhya(); 12 | 13 | a3.home(); 14 | a3.car(); 15 | a3.office(); 16 | 17 | a2.home(); 18 | a2.car(); 19 | 20 | a1.home(); 21 | 22 | System.out.println(a1.qualification); 23 | System.out.println(a2.qualification); 24 | System.out.println(a3.qualification); 25 | 26 | 27 | a1=new Shweta(); 28 | a1.home(); 29 | a1.gold(); 30 | a1.car(); 31 | a1.office(); 32 | } 33 | } 34 | 35 | //as home() is a method, we are calling a method 36 | //method belongs to the object 37 | //object is of Abhishek 38 | //hence it will invoke the home() of Abhishek class 39 | 40 | //as qulaification is a property, we are accessing a property 41 | //property belongs to the ref 42 | //ref is of Amitabh 43 | //hence it will access the qualification of Amitabh 44 | -------------------------------------------------------------------------------- /src/day6/HashMapDemo.java: -------------------------------------------------------------------------------- 1 | package day6; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | import java.util.Map.Entry; 6 | import java.util.Set; 7 | 8 | public class HashMapDemo { 9 | 10 | public static void main(String[] args) { 11 | Map employees=new HashMap(); 12 | employees.put("Alice", 800); 13 | employees.put("Ben", 900); 14 | employees.put("Chris", 850); 15 | 16 | System.out.println(employees); 17 | System.out.println(employees.get("Alice")); 18 | 19 | 20 | Set keys=employees.keySet(); 21 | System.out.println(keys); 22 | 23 | 24 | //display name of the empl earning max salary 25 | Entry maxEmp=null; 26 | int maxSal=0; 27 | for(Entry entry:employees.entrySet()) 28 | { 29 | if(entry.getValue()>maxSal) 30 | { 31 | maxSal=entry.getValue(); 32 | maxEmp=entry; 33 | } 34 | } 35 | 36 | System.out.println("Employee with Maximum Salary is "+maxEmp.getKey()); 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/day6/GroupWordsByLength.java: -------------------------------------------------------------------------------- 1 | package day6; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Arrays; 5 | import java.util.HashMap; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public class GroupWordsByLength { 10 | 11 | public static void main(String[] args) { 12 | List input = new ArrayList(Arrays.asList("Lion", "Tiger","Zebra", "Elephant", "Cat","Dog")); 13 | Map> animalGroups=new HashMap(); {} //not a single entry present 14 | 15 | for(String animal:input) 16 | { 17 | int length=animal.length(); //animal //length animalsGroups 18 | animalGroups.putIfAbsent(length, new ArrayList()); //lion //4 {4=[lion]} 19 | //tiger //5 {5=[tiger]} 20 | animalGroups.get(length).add(animal); //zebra //5 {5=[tiger,zebra]} 21 | } 22 | System.out.println(animalGroups); 23 | } 24 | } 25 | 26 | //groupAnagrams 27 | //List input = new ArrayList(Arrays.asList("abc", "bac","cba", "ate", "tan","nat")); 28 | //[abc,bac,cba] 29 | //[ate] 30 | //[tan,nat] -------------------------------------------------------------------------------- /src/day8/InsertUsingPreparedStatement.java: -------------------------------------------------------------------------------- 1 | package day8; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.SQLException; 6 | import java.util.Scanner; 7 | 8 | public class InsertUsingPreparedStatement { 9 | 10 | public static void main(String[] args) throws ClassNotFoundException, SQLException { 11 | Scanner sc=new Scanner(System.in); 12 | System.out.println("Enter Epmloyee Number"); 13 | int a=sc.nextInt(); 14 | 15 | System.out.println("Enter Employee Name"); 16 | String b=sc.next(); 17 | 18 | System.out.println("Enter Employee Salary"); 19 | double c=sc.nextDouble(); 20 | 21 | String query="insert into emp values(?,?,?)"; 22 | Connection con=MySQLDatabaseConnectionKIIT.getDBConnection(); 23 | PreparedStatement ps=con.prepareStatement(query); 24 | ps.setInt(1, a); 25 | ps.setString(2, b); 26 | ps.setDouble(3, c); 27 | 28 | int rows=ps.executeUpdate(); 29 | if(rows>0) 30 | System.out.println(rows +" Records Inserted"); 31 | else 32 | System.out.println("Error In Insertion"); 33 | 34 | ps.close(); 35 | con.close(); 36 | 37 | 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/day6/ArrayListDemo.java: -------------------------------------------------------------------------------- 1 | package day6; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Arrays; 5 | 6 | public class ArrayListDemo { 7 | 8 | public static void main(String[] args) { 9 | ArrayList names=new ArrayList(); 10 | names.add("Alice"); 11 | names.add("Ben"); 12 | names.add("Chris"); 13 | 14 | System.out.println(names); 15 | 16 | 17 | ArrayList names1=new ArrayList(Arrays.asList("David","Elcid","Frank")); 18 | System.out.println(names1); 19 | 20 | Student s1=new Student(); //this was using the default constructor gifted to the developer by java int=0, char='', double=0.0, booleabn=false, object=null 21 | Student s2=new Student(); 22 | Student s3=new Student(); 23 | Student s4=new Student(18,"Virat",78.5); 24 | Student s5=new Student(s4); //invokes the copy constructor, deep copies 25 | 26 | s1.displayStudent(); 27 | s2.displayStudent(); 28 | s3.displayStudent(); 29 | s4.displayStudent(); //rno=45 30 | s5.displayStudent(); //rno=18 31 | 32 | 33 | 34 | Student s6=new Student(); 35 | Student s7=s6; //shallow copy means - call by reference 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/day8/UpdateUsingPreparedStatement.java: -------------------------------------------------------------------------------- 1 | package day8; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.SQLException; 6 | import java.sql.Statement; 7 | import java.util.Scanner; 8 | 9 | public class UpdateUsingPreparedStatement { 10 | 11 | public static void main(String[] args) throws ClassNotFoundException, SQLException { 12 | Connection con=MySQLDatabaseConnectionKIIT.getDBConnection(); 13 | 14 | Scanner sc=new Scanner(System.in); 15 | 16 | System.out.println("Enter Employee Number"); 17 | int a=sc.nextInt(); 18 | 19 | 20 | System.out.println("Enter New Employee Name"); 21 | String b=sc.next(); 22 | 23 | System.out.println("Enter New Employee Salary"); 24 | double c=sc.nextDouble(); 25 | 26 | 27 | 28 | String query="update emp set ename=?,sal=? where eno=?"; 29 | 30 | PreparedStatement ps=con.prepareStatement(query); 31 | 32 | ps.setString(1, b); 33 | ps.setDouble(2, c); 34 | ps.setInt(3, a); 35 | 36 | int rows=ps.executeUpdate(); 37 | 38 | if(rows>0) 39 | System.out.println(rows +"Records Updated"); 40 | else 41 | System.out.println("Error In Updation"); 42 | 43 | ps.close(); 44 | con.close(); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/day5/ThrowsKeywordDemo.java: -------------------------------------------------------------------------------- 1 | package day5; 2 | 3 | import java.io.IOException; 4 | import java.util.InputMismatchException; 5 | import java.util.Scanner; 6 | 7 | import day4.LowQuantityException; 8 | 9 | public class ThrowsKeywordDemo { 10 | 11 | public static void main(String[] args) throws IOException 12 | { 13 | Scanner sc=new Scanner(System.in); 14 | try 15 | { 16 | System.out.println("Enter Numerator"); //10 17 | int numerator=sc.nextInt(); //new InputMismatchException() 18 | 19 | System.out.println("Enter Denominator");//0 20 | int denominator=sc.nextInt(); 21 | double result=divide(numerator,denominator); 22 | System.out.println(result); 23 | } 24 | catch(ArithmeticException e1) 25 | { 26 | System.out.println("Please enter non zero denominator"); 27 | } 28 | catch(InputMismatchException e2) 29 | { 30 | System.out.println("Please enter valid Integer value"); 31 | } 32 | finally 33 | { 34 | System.out.println("Thank you!!"); //cleanup 35 | } 36 | } 37 | 38 | private static double divide(int numerator, int denominator) throws ArithmeticException,InputMismatchException,IOException 39 | { 40 | return numerator / denominator; 41 | } 42 | 43 | } 44 | 45 | //throw, throws,Throwable 46 | //final finally finalize -------------------------------------------------------------------------------- /src/day4/CheckedDemo.java: -------------------------------------------------------------------------------- 1 | package day4; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStreamReader; 6 | import java.util.Scanner; 7 | 8 | public class CheckedDemo { 9 | 10 | public static void main(String[] args) { 11 | BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); 12 | try 13 | { 14 | System.out.println("Enter Numerator"); 15 | int numerator=Integer.parseInt(br.readLine()); 16 | 17 | System.out.println("Enter Denominator"); 18 | int denominator=Integer.parseInt(br.readLine()); 19 | double result=numerator/denominator; 20 | System.out.println(result); 21 | } 22 | catch(IOException e1) {} 23 | 24 | // / by zero ArithmeticException 1. search in vast lib or exception classess to which class the ex belongs 25 | //ArithmeticException 26 | //2. creates an object of that class 27 | // new ArithmeticException() 28 | //3. throws the object 29 | 30 | //4a. catch the object 4b. drop the object 31 | //. program will terminate/crash 32 | //it spills on the console the cause and metadat about the excepion 33 | //in which package,class,method, line, message 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/day8/InsertUsingStatement.java: -------------------------------------------------------------------------------- 1 | package day8; 2 | 3 | import java.sql.Connection; 4 | import java.sql.DriverManager; 5 | import java.sql.SQLException; 6 | import java.sql.Statement; 7 | 8 | public class InsertUsingStatement { 9 | 10 | public static void main(String[] args) throws ClassNotFoundException 11 | { 12 | //Class.forName("com.mysql.cj.jdbc.Driver"); version 8 13 | 14 | Class.forName("com.mysql.jdbc.Driver"); //version 8 15 | try 16 | { 17 | Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/kiitdb","root",""); 18 | 19 | Statement st=con.createStatement(); 20 | String query1="insert into emp values(104,'David',900.00)"; //return 1 delete from emp where dname like 'IT' return 5 21 | String query2="insert into emp values(105,'Elcid',850.00)"; //return 1 22 | String query3="insert into emp values(106,'Frank',750.00)"; //return 1 23 | st.addBatch(query1); 24 | st.addBatch(query2); 25 | st.addBatch(query3); 26 | 27 | // 0 1 2 28 | // 1 1 1 29 | int rows[]=st.executeBatch(); 30 | if(rows.length>0) 31 | System.out.println(rows.length +"Records Inserted"); 32 | else 33 | System.out.println("Error In Insertion"); 34 | 35 | st.close(); 36 | con.close(); 37 | 38 | } 39 | catch(SQLException e1) 40 | { 41 | System.out.println(e1.getMessage()); 42 | } 43 | 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/day6/GroupWordsByAnagrams.java: -------------------------------------------------------------------------------- 1 | package day6; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Arrays; 5 | import java.util.Collection; 6 | import java.util.HashMap; 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | public class GroupWordsByAnagrams { 11 | 12 | public static void main(String[] args) { // abc abc abc 13 | List input = new ArrayList(Arrays.asList("abc", "bac", "cba", "ate", "tan", "nat")); 14 | System.out.println(groupedAnagrams(input)); 15 | } 16 | 17 | private static Collection> groupedAnagrams(List input) { 18 | Map> angramGroups = new HashMap(); 19 | 20 | for (String word : input) { 21 | char arr[] = word.toCharArray(); 22 | Arrays.sort(arr); 23 | String key = new String(arr); 24 | angramGroups.putIfAbsent(key, new ArrayList()); // lion //4 {4=[lion]} 25 | // tiger //5 {5=[tiger]} 26 | angramGroups.get(key).add(word); // zebra //5 {5=[tiger,zebra]} 27 | } 28 | return angramGroups.values(); 29 | } 30 | } 31 | 32 | //groupAnagrams 33 | //List input = new ArrayList(Arrays.asList("abc", "bac","cba", "ate", "tan","nat")); 34 | //[abc,bac,cba] 35 | //[ate] 36 | //[tan,nat] 37 | 38 | // {[()]} wellforemd 39 | 40 | // {[[)} not well formed - Stack 41 | 42 | // string is palindorme 43 | //without using a second string 44 | //Stack -------------------------------------------------------------------------------- /src/day8/InsertUsingPreparedStatementBatch.java: -------------------------------------------------------------------------------- 1 | package day8; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.SQLException; 6 | import java.util.Scanner; 7 | 8 | public class InsertUsingPreparedStatementBatch { 9 | 10 | public static void main(String[] args) throws ClassNotFoundException, SQLException { 11 | Connection con=MySQLDatabaseConnectionKIIT.getDBConnection(); 12 | PreparedStatement ps=null; 13 | Scanner sc=new Scanner(System.in); 14 | 15 | System.out.println("Enter Number of Employees"); 16 | int size=sc.nextInt(); 17 | 18 | String query="insert into emp values(?,?,?)"; 19 | ps=con.prepareStatement(query); 20 | 21 | for(int i=0;i0) 41 | System.out.println(rows.length +" Records Inserted"); 42 | else 43 | System.out.println("Error In Insertion"); 44 | 45 | ps.close(); 46 | con.close(); 47 | 48 | 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/day6/IteratorDemo.java: -------------------------------------------------------------------------------- 1 | package day6; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Iterator; 5 | import java.util.ListIterator; 6 | 7 | public class IteratorDemo { 8 | 9 | public static void main(String[] args) { 10 | ArrayList names=new ArrayList(); 11 | names.add("Alice"); 12 | names.add("Ben"); 13 | names.add("Chris"); 14 | names.add("David"); 15 | names.add("Elcid"); 16 | 17 | // Iterator itr=names.iterator(); 18 | // 19 | // while(itr.hasNext()) //uni directional 20 | // System.out.println(itr.next()); 21 | // 22 | 23 | // System.out.println("Forward Direction"); 24 | // ListIterator listItr=names.listIterator(); 25 | // while(listItr.hasNext()) //uni directional 26 | // System.out.println(listItr.next()); 27 | // 28 | // 29 | // System.out.println("Reverse Direction"); 30 | // while(listItr.hasPrevious()) //uni directional 31 | // System.out.println(listItr.previous()); 32 | 33 | ListIterator listItr=names.listIterator(); //bi direction, remove, replace(set()) 34 | while(listItr.hasNext()) 35 | { 36 | String item=listItr.next(); 37 | if(item.length()<5) 38 | //listItr.remove(); 39 | listItr.set("Benten"); 40 | } 41 | 42 | System.out.println(names); 43 | } 44 | 45 | 46 | // input ["Merc India","Audi","BMW India","Mahindra"] 47 | // output["Merc India","Audi India","BMW India","Mahindra India"] 48 | } 49 | -------------------------------------------------------------------------------- /src/day6/TreeSetDemo.java: -------------------------------------------------------------------------------- 1 | package day6; 2 | 3 | import java.util.Set; 4 | import java.util.TreeSet; 5 | 6 | public class TreeSetDemo { 7 | 8 | public static void main(String[] args) { 9 | Student s1=new Student(1,"Rahul",78.5); //each time will be compared on a single property Comporable 10 | Student s2=new Student(45,"Rohit",88.5); 11 | Student s3=new Student(33,"Hardik",68.5); 12 | Student s4=new Student(18,"Virat",98.5); 13 | Student s5=new Student(77,"Shubman",87.5); 14 | 15 | // Set rankingStudents=new TreeSet(); //dsc order of per Comparator 16 | // rankingStudents.add(s1); 17 | // rankingStudents.add(s2); 18 | // rankingStudents.add(s3); 19 | // rankingStudents.add(s4); 20 | // rankingStudents.add(s5); 21 | // System.out.println(rankingStudents); 22 | 23 | 24 | // Set attendanceStudents=new TreeSet(); // asc order of rno 25 | // attendanceStudents.add(s1); 26 | // attendanceStudents.add(s2); 27 | // attendanceStudents.add(s3); 28 | // attendanceStudents.add(s4); 29 | // attendanceStudents.add(s5); 30 | // System.out.println(attendanceStudents); 31 | // 32 | // 33 | Set examSeatingStudents=new TreeSet(); // asc order of sname 34 | examSeatingStudents.add(s1); 35 | examSeatingStudents.add(s2); 36 | examSeatingStudents.add(s3); 37 | examSeatingStudents.add(s4); 38 | examSeatingStudents.add(s5); 39 | System.out.println(examSeatingStudents); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/day3hotfutsolution/DriverApp.java: -------------------------------------------------------------------------------- 1 | package day3hotfutsolution; 2 | 3 | import java.util.Scanner; 4 | 5 | public class DriverApp { 6 | 7 | public static void main(String[] args) { 8 | Scanner sc=new Scanner(System.in); 9 | 10 | System.out.println("Enter Name"); 11 | String customerName=sc.next(); 12 | System.out.println("Enter Date"); 13 | String dateOfPlay=sc.next(); 14 | System.out.println("Enter Time"); 15 | String timeOfPlay=sc.next(); 16 | 17 | System.out.println("***Turf Options***"); 18 | System.out.println("1. Cricket"); 19 | System.out.println("2. Football"); 20 | System.out.println("3. Tennis"); 21 | System.out.println("4. Skating"); 22 | System.out.println("0. Exit"); 23 | System.out.println("Enter Choice"); 24 | int turfChoice=sc.nextInt(); 25 | if(turfChoice!=0) 26 | { 27 | Turf turf=TurfFactory.getTurf(turfChoice); 28 | displayBill(customerName,dateOfPlay,timeOfPlay,turf); 29 | } 30 | else 31 | System.out.println("Session Expired"); 32 | } 33 | 34 | private static void displayBill(String customerName, String dateOfPlay, String timeOfPlay, Turf turf) { 35 | System.out.println("**** BILL ****"); 36 | System.out.println("Customer name "+customerName); 37 | System.out.println("Play Date "+dateOfPlay); 38 | System.out.println("Play Time "+timeOfPlay); 39 | System.out.println("Turf Type" + turf.getTurfType()); 40 | System.out.println("Cost" + turf.getTurfPrice()); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/day4/NestedTryDemo.java: -------------------------------------------------------------------------------- 1 | package day4; 2 | 3 | import java.util.InputMismatchException; 4 | import java.util.Scanner; 5 | 6 | public class NestedTryDemo { 7 | 8 | public static void main(String[] args) { 9 | Scanner sc=new Scanner(System.in); 10 | int arr[]=new int[2]; 11 | try 12 | { 13 | System.out.println("Enter Value for index 0 : "); //10 apple 14 | arr[0]=sc.nextInt(); //new InputMismatchException() 15 | 16 | System.out.println("Enter Value for index 1 : ");//0 17 | arr[1]=sc.nextInt(); 18 | 19 | 20 | try 21 | { 22 | System.out.println("Enter the index of the number you wish to be Numerator : "); //apple 23 | int n=sc.nextInt(); 24 | int numerator=arr[n]; 25 | 26 | System.out.println("Enter the index of the number you wish to be Denominator : "); //1 apple 27 | int d=sc.nextInt(); 28 | int denominator=arr[d]; 29 | 30 | double result=numerator/denominator; 31 | System.out.println("Result is "+result); 32 | } 33 | catch(ArithmeticException e1) 34 | { 35 | System.out.println("cannot "+e1.getMessage()); // cannot / by zero 36 | } 37 | catch(ArrayIndexOutOfBoundsException e2) 38 | { 39 | System.out.println("Invalid Index"); // cannot / by zero 40 | } 41 | } 42 | catch(InputMismatchException e1) 43 | { 44 | System.out.println("Please enter valid integer values only"); 45 | } 46 | 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/day6/TreeSetDemo2.java: -------------------------------------------------------------------------------- 1 | package day6; 2 | 3 | import java.util.Set; 4 | import java.util.TreeSet; 5 | 6 | public class TreeSetDemo2 { 7 | 8 | public static void main(String[] args) { 9 | Student s1=new Student(1,"Rahul",78.5); //each time will be compared on a single property Comporable 10 | Student s2=new Student(45,"Rohit",88.5); 11 | Student s3=new Student(33,"Hardik",68.5); 12 | Student s4=new Student(18,"Virat",98.5); 13 | Student s5=new Student(77,"Shubman",87.5); 14 | 15 | // Set rankingStudents=new TreeSet(new PercentageComparator()); //dsc order of per Comparator 16 | // rankingStudents.add(s1); 17 | // rankingStudents.add(s2); 18 | // rankingStudents.add(s3); 19 | // rankingStudents.add(s4); 20 | // rankingStudents.add(s5); 21 | // //System.out.println(rankingStudents); 22 | // 23 | // for(Student s:rankingStudents) 24 | // { 25 | // System.out.println(s); 26 | // } 27 | Set attendanceStudents=new TreeSet(new RnoComparator()); // asc order of rno 28 | attendanceStudents.add(s1); 29 | attendanceStudents.add(s2); 30 | attendanceStudents.add(s3); 31 | attendanceStudents.add(s4); 32 | attendanceStudents.add(s5); 33 | System.out.println(attendanceStudents); 34 | // 35 | // 36 | // Set examSeatingStudents=new TreeSet(); // asc order of sname 37 | // examSeatingStudents.add(s1); 38 | // examSeatingStudents.add(s2); 39 | // examSeatingStudents.add(s3); 40 | // examSeatingStudents.add(s4); 41 | // examSeatingStudents.add(s5); 42 | // System.out.println(examSeatingStudents); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/day6/HashMapDemo2.java: -------------------------------------------------------------------------------- 1 | package day6; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | public class HashMapDemo2 { 9 | 10 | public static void main(String[] args) { 11 | Map std8=new HashMap(); 12 | std8.put("first", new Student(18,"Virat",98.5)); 13 | std8.put("second", new Student(45,"Rohit",88.5)); 14 | std8.put("third", new Student(33,"Hardik",78.5)); 15 | 16 | 17 | //System.out.println(std8.get("first").getSname()); 18 | 19 | Map std9=new HashMap(); 20 | std9.put("first", new Student(77,"Shubman",87.5)); 21 | std9.put("second", new Student(1,"Rahul",86.5)); 22 | std9.put("third", new Student(3,"Shami",81.5)); 23 | 24 | //System.out.println(std9.get("first").getSname()); 25 | 26 | Map std10=new HashMap(); 27 | std10.put("first", new Student(43,"Alice",87.5)); 28 | std10.put("second", new Student(19,"Ben",86.5)); 29 | std10.put("third", new Student(36,"Chris",81.5)); 30 | 31 | 32 | List> schoolResuls=new ArrayList(); 33 | schoolResuls.add(std8); 34 | schoolResuls.add(std9); 35 | schoolResuls.add(std10); 36 | 37 | //using the schoolResult, display toppers name from each class 38 | System.out.println("Topper Names"); 39 | // for(Map classResult: schoolResuls) 40 | // { 41 | // System.out.println(classResult.get("first").getSname()); 42 | // } 43 | 44 | for(int i=0;i hs1=new HashSet(); 14 | System.out.println(hs1.add("Alice")); 15 | hs1.add("Tom"); 16 | hs1.add("Ben"); 17 | hs1.add("Frank"); 18 | System.out.println(hs1.add("Tom")); 19 | hs1.add("Chris"); 20 | 21 | System.out.println(hs1); 22 | 23 | 24 | Set setA=new HashSet(Arrays.asList(1,2,3)); 25 | Set setB=new HashSet(Arrays.asList(4,5,6)); 26 | System.out.println("set A"+setA); 27 | System.out.println("set B"+setB); 28 | //union 29 | setA.addAll(setB); 30 | System.out.println("Union"+setA); 31 | 32 | 33 | 34 | Set setX=new HashSet(Arrays.asList(1,2,3,4,5)); 35 | Set setY=new HashSet(Arrays.asList(4,5,6)); 36 | System.out.println("set X"+setX); 37 | System.out.println("set Y"+setY); 38 | setX.retainAll(setY); 39 | System.out.println("Intersection "+setX); 40 | 41 | 42 | 43 | 44 | Set lhs=new LinkedHashSet(); //Linked order is preserved 45 | lhs.add("Alice"); 46 | lhs.add("Tom"); 47 | lhs.add("Ben"); 48 | lhs.add("Frank"); 49 | lhs.add("Tom"); 50 | lhs.add("Chris"); 51 | 52 | System.out.println(lhs); 53 | 54 | 55 | 56 | Set ts=new TreeSet(); //Linked order is preserved 57 | ts.add("Alice"); 58 | ts.add("Tom"); 59 | ts.add("Ben"); 60 | ts.add("Frank"); 61 | ts.add("Tom"); 62 | ts.add("Chris"); 63 | 64 | System.out.println(ts); 65 | 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/day6/ArrayListDemo2.java: -------------------------------------------------------------------------------- 1 | package day6; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class ArrayListDemo2 { 7 | 8 | public static void main(String[] args) { 9 | 10 | 11 | Student s1=new Student(1,"Rahul",78.5); 12 | Student s2=new Student(45,"Rohit",88.5); 13 | Student s3=new Student(33,"Hardik",68.5); 14 | Student s4=new Student(18,"Virat",98.5); 15 | Student s5=new Student(77,"Shubman",87.5); 16 | 17 | List students=new ArrayList(); 18 | students.add(s1); 19 | students.add(s2); 20 | students.add(s3); 21 | students.add(s4); 22 | students.add(s5); 23 | 24 | //display the details of the student who has secured the max marks 25 | double max=0.0; 26 | Student maxStudent=null; 27 | for(Student student:students) 28 | { 29 | if(student.getPer()>max) 30 | { 31 | max=student.getPer(); 32 | maxStudent=student; 33 | } 34 | } 35 | 36 | System.out.println(maxStudent);//display the object , println expects the data tobe in String format 37 | // we need some converter to convert from object to String 38 | //toString() object class, override the toString() 39 | 40 | //maxStudent.displayStudent(); 41 | 42 | } 43 | //[10,20,30,40,50] //90 2 sum problem , 3 sum problem [40,50] 44 | // string, arrays 45 | // first repeating char rohit sharma : 'r' 46 | // first non repeating char rohit sharma : 'o' 47 | // group anagrams ["cab", "bca", "nat", "tan", "apple", "mango", "abc"] 48 | /* ["cab", "bca","abc"] 49 | ["tan", "nat"] 50 | ["mango"] 51 | ["apple"]*/ 52 | //binary search 53 | //sorting,rotation 54 | //PriorityQueue 55 | //Stack 56 | } 57 | -------------------------------------------------------------------------------- /src/day4/UncheckedDemo.java: -------------------------------------------------------------------------------- 1 | package day4; 2 | 3 | import java.util.InputMismatchException; 4 | import java.util.Scanner; 5 | 6 | public class UncheckedDemo { 7 | 8 | public static void main(String[] args) { 9 | Scanner sc=new Scanner(System.in); 10 | try 11 | { 12 | System.out.println("Enter Numerator"); //10 13 | int numerator=sc.nextInt(); //new InputMismatchException() 14 | 15 | System.out.println("Enter Denominator");//0 16 | int denominator=sc.nextInt(); 17 | 18 | // String name=null; 19 | // System.out.println(name.length()); //new NullPointerException 20 | // 21 | // int arr[]=new int[2]; 22 | // arr[2]=10; //new ArrayIndexOutOfBoundsException 23 | 24 | double result=numerator/denominator; // / by zero ArithmeticException 1. search in vast lib or exception classess to which class the ex belongs 25 | System.out.println(result); 26 | } //ArithmeticException 27 | catch(ArithmeticException e1) //2. creates an object of that class 28 | { 29 | System.out.println(e1.getMessage()); 30 | } 31 | // catch(InputMismatchException e2)// new ArithmeticException() 32 | // { //3. throws the object 33 | // System.out.println("Please enter valid integer value only"); 34 | // } //4a. catch the object 4b. drop the object 35 | // catch(NullPointerException | ArrayIndexOutOfBoundsException e3) // . the execution contine //. program will terminate/crash 36 | // { 37 | // System.out.println("Some error occured"); //it spills on the console the cause and metadat about the excepion 38 | // } 39 | //in which package,class,method, line, message 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/day1/Student.java: -------------------------------------------------------------------------------- 1 | package day1; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Student { 6 | 7 | private int rno; //properties 8 | private String sname; 9 | private double per; 10 | 11 | 12 | //to read and write private data outside the class we have special methods 13 | //known as setter getter methods 14 | //create a pair(set,get) for each private property 15 | 16 | //right click inside the class anywhere 17 | //source 18 | //generate setter getter 19 | //select All 20 | //click generate 21 | 22 | public void acceptStudent() //methods 23 | { 24 | Scanner sc=new Scanner(System.in); //Predefined class ctrl shift O 25 | System.out.println("Please enter roll no"); //18 26 | rno=sc.nextInt(); 27 | System.out.println("Please enter Student name"); //18 28 | sname=sc.next(); 29 | System.out.println("Please enter Student Percentage"); //18 30 | per=sc.nextDouble(); 31 | } 32 | 33 | public int getRno() { 34 | return rno; 35 | } 36 | 37 | public void setRno(int rno) { 38 | this.rno = rno; 39 | } 40 | 41 | public String getSname() { 42 | return sname; 43 | } 44 | 45 | public void setSname(String sname) { 46 | this.sname = sname; 47 | } 48 | 49 | public double getPer() { 50 | return per; 51 | } 52 | 53 | public void setPer(double per) { 54 | this.per = per; 55 | } 56 | 57 | public void displayStudent() 58 | { 59 | Student s2 = new Student(); 60 | s2.rno=18; 61 | System.out.println("Roll Number is "+rno); 62 | System.out.println("Student Name is "+sname); 63 | System.out.println("Percentage is "+per); 64 | } 65 | } 66 | 67 | //Job profile : Java Developer 68 | //the class methods have "DIRECT" access to the class properties 69 | //Note printing machine : class notes : objects 70 | //half done 71 | //class is a blue print to create objects -------------------------------------------------------------------------------- /src/day7/Student.java: -------------------------------------------------------------------------------- 1 | package day7; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Student { 6 | 7 | private int rno; //properties 8 | private String sname; 9 | private double per; 10 | 11 | 12 | //to read and write private data outside the class we have special methods 13 | //known as setter getter methods 14 | //create a pair(set,get) for each private property 15 | 16 | //right click inside the class anywhere 17 | //source 18 | //generate setter getter 19 | //select All 20 | //click generate 21 | 22 | public void acceptStudent() //methods 23 | { 24 | Scanner sc=new Scanner(System.in); //Predefined class ctrl shift O 25 | System.out.println("Please enter roll no"); //18 26 | rno=sc.nextInt(); 27 | System.out.println("Please enter Student name"); //18 28 | sname=sc.next(); 29 | System.out.println("Please enter Student Percentage"); //18 30 | per=sc.nextDouble(); 31 | } 32 | 33 | public int getRno() { 34 | return rno; 35 | } 36 | 37 | public void setRno(int rno) { 38 | this.rno = rno; 39 | } 40 | 41 | public String getSname() { 42 | return sname; 43 | } 44 | 45 | public void setSname(String sname) { 46 | this.sname = sname; 47 | } 48 | 49 | public double getPer() { 50 | return per; 51 | } 52 | 53 | public void setPer(double per) { 54 | this.per = per; 55 | } 56 | 57 | public void displayStudent() 58 | { 59 | Student s2 = new Student(); 60 | s2.rno=18; 61 | System.out.println("Roll Number is "+rno); 62 | System.out.println("Student Name is "+sname); 63 | System.out.println("Percentage is "+per); 64 | } 65 | } 66 | 67 | //Job profile : Java Developer 68 | //the class methods have "DIRECT" access to the class properties 69 | //Note printing machine : class notes : objects 70 | //half done 71 | //class is a blue print to create objects -------------------------------------------------------------------------------- /src/day3/Student.java: -------------------------------------------------------------------------------- 1 | package day3; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Student { 6 | 7 | private int rno; //instance scope 8 | private String sname; //instance 9 | private double per; //instance 10 | 11 | private static String principalName; //static or class scope 12 | private static String collegeName; 13 | 14 | static { 15 | principalName="Smith"; 16 | collegeName="Wadia College"; 17 | } 18 | 19 | //to read and write private data outside the class we have special methods 20 | //known as setter getter methods 21 | //create a pair(set,get) for each private property 22 | 23 | //right click inside the class anywhere 24 | //source 25 | //generate setter getter 26 | //select All 27 | //click generate 28 | 29 | 30 | 31 | public void acceptStudent() //methods 32 | { 33 | Scanner sc=new Scanner(System.in); //Predefined class ctrl shift O 34 | System.out.println("Please enter roll no"); //18 35 | rno=sc.nextInt(); 36 | System.out.println("Please enter Student name"); //18 37 | sname=sc.next(); 38 | System.out.println("Please enter Student Percentage"); //18 39 | per=sc.nextDouble(); 40 | } 41 | 42 | public static void displayPrincipalName() 43 | { 44 | System.out.println(Student.principalName); 45 | test(); 46 | } 47 | 48 | public static void test() 49 | { 50 | int x; //local scope 51 | System.out.println("hi"); 52 | } 53 | 54 | public int getRno() { 55 | return rno; 56 | } 57 | 58 | public void setRno(int rno) { 59 | this.rno = rno; 60 | } 61 | 62 | public String getSname() { 63 | return sname; 64 | } 65 | 66 | public void setSname(String sname) { 67 | this.sname = sname; 68 | } 69 | 70 | public double getPer() { 71 | return per; 72 | } 73 | 74 | public void setPer(double per) { 75 | this.per = per; 76 | } 77 | 78 | public void displayStudent() 79 | { 80 | System.out.println("Roll Number is "+this.rno); 81 | System.out.println("Student Name is "+this.sname); 82 | System.out.println("Percentage is "+this.per); 83 | } 84 | } 85 | 86 | //Job profile : Java Developer 87 | //the class methods have "DIRECT" access to the class properties 88 | //Note printing machine : class notes : objects 89 | //half done 90 | //class is a blue print to create objects -------------------------------------------------------------------------------- /src/day6/CollectionMethodsDemo.java: -------------------------------------------------------------------------------- 1 | package day6; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class CollectionMethodsDemo { 7 | 8 | public static void main(String[] args) { 9 | List list=new ArrayList(); 10 | list.add("Alice"); //0 11 | list.add("Ben"); //1 12 | list.add("Chris"); //2 13 | list.add("Dom"); //3 14 | list.add("Elcid"); //4 15 | // 0 1 2 3 4 16 | System.out.println(list); //[Alice,Ben,Chris,David,Elcid] 17 | 18 | // 0 1 2 3 4 5 19 | list.add(2,"Bharat"); //[Alice,Ben,Bharat,Chris,David,Elcid] 20 | System.out.println(list); 21 | // 0 1 2 3 4 5 6 22 | System.out.println(list.get(1).length()); 23 | 24 | 25 | List list1=new ArrayList(); 26 | list1.add(1); 27 | list1.add(2); 28 | list1.add(3); 29 | 30 | System.out.println(list1); 31 | System.out.println(list1.remove(1)); //when we pass integer as a parameter to the remove method it will prioritise the index removal 32 | System.out.println(list1); // [1,3] 33 | System.out.println(list1.remove(Integer.valueOf(1))); //remove the element 1 34 | 35 | 36 | List rj=new ArrayList(); 37 | rj.add("Jaipur"); 38 | rj.add("Bikaner"); 39 | rj.add("Fatehpur"); 40 | 41 | List mh=new ArrayList(); 42 | mh.add("Pune"); 43 | mh.add("Mumbai"); 44 | mh.add("Nashik"); 45 | 46 | List or=new ArrayList(); 47 | or.add("Rourkela"); 48 | or.add("Kalinga"); 49 | or.add("Bhubaneshwar"); 50 | 51 | List> India=new ArrayList<>(); 52 | India.add(rj); 53 | India.add(mh); 54 | 55 | 56 | System.out.println(India); //[[Jaipur,Bikaner,Fatehpur],[Pune,Mumbai,Nashik],[]] 57 | //System.out.println(India.get(0).get(1)); 58 | 59 | 60 | System.out.println(India); 61 | 62 | //addAll 63 | System.out.println(India.size()); //2 64 | List India1=new ArrayList(); 65 | India1.addAll(rj); 66 | India1.addAll(mh); 67 | India1.addAll(or); 68 | System.out.println(India1.size()); //9 69 | System.out.println(India1); 70 | // India1.removeAll(mh); 71 | // System.out.println(India1); 72 | 73 | India1.retainAll(or); 74 | System.out.println(India1); 75 | 76 | System.out.println(India1.isEmpty()); 77 | India1.clear(); 78 | System.out.println(India1.isEmpty()); 79 | 80 | 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /src/day6/Student.java: -------------------------------------------------------------------------------- 1 | package day6; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Student implements Cloneable//,Comparable 6 | { 7 | 8 | private int rno; //properties 9 | private String sname; 10 | private double per; 11 | 12 | 13 | //to read and write private data outside the class we have special methods 14 | //known as setter getter methods 15 | //create a pair(set,get) for each private property 16 | 17 | //right click inside the class anywhere 18 | //source 19 | //generate setter getter 20 | //select All 21 | //click generate 22 | 23 | public Student() //it will override the default constructor 24 | { 25 | this.rno=1; 26 | this.sname="Alice"; 27 | this.per=50.0; 28 | } 29 | 30 | public Student(int a,String b, double c) //it will overload the constructor 31 | { 32 | this.rno=a; 33 | this.sname=b; 34 | this.per=c; 35 | } 36 | public Student(Student stud) //it will overload the constructor 37 | { 38 | this.rno=stud.rno; 39 | this.sname=stud.sname; 40 | this.per=stud.per; 41 | stud.rno=45; 42 | } 43 | public void acceptStudent() //methods 44 | { 45 | Scanner sc=new Scanner(System.in); //Predefined class ctrl shift O 46 | System.out.println("Please enter roll no"); //18 47 | rno=sc.nextInt(); 48 | System.out.println("Please enter Student name"); //18 49 | sname=sc.next(); 50 | System.out.println("Please enter Student Percentage"); //18 51 | per=sc.nextDouble(); 52 | } 53 | 54 | public int getRno() { 55 | return rno; 56 | } 57 | 58 | public void setRno(int rno) { 59 | this.rno = rno; 60 | } 61 | 62 | public String getSname() { 63 | return sname; 64 | } 65 | 66 | public void setSname(String sname) { 67 | this.sname = sname; 68 | } 69 | 70 | public double getPer() { 71 | return per; 72 | } 73 | 74 | public void setPer(double per) { 75 | this.per = per; 76 | } 77 | 78 | public void displayStudent() 79 | { 80 | Student s2 = new Student(); 81 | s2.rno=18; 82 | System.out.println("Roll Number is "+rno); 83 | System.out.println("Student Name is "+sname); 84 | System.out.println("Percentage is "+per); 85 | } 86 | 87 | @Override 88 | protected Object clone() throws CloneNotSupportedException { 89 | // TODO Auto-generated method stub 90 | return super.clone(); 91 | } 92 | 93 | @Override 94 | public String toString() { 95 | return "Student [rno=" + rno + ", sname=" + sname + ", per=" + per + "]"; 96 | } 97 | 98 | // @Override 99 | // public int compareTo(Student stud) { 100 | // return sname.compareTo(stud.sname); 101 | // } 102 | 103 | // @Override 104 | // public int compareTo(Student stud) { 105 | // if(rno>stud.rno) 106 | // return 1; 107 | // else if(rnostud.per) 117 | // return -1; 118 | // else if(per