From 4e307a044479531612ef99ca084cf5220d4ee2f5 Mon Sep 17 00:00:00 2001 From: Anjali853 Date: Tue, 6 May 2025 11:01:00 +0530 Subject: [PATCH 01/12] Overriding --- Hello.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Hello.java diff --git a/Hello.java b/Hello.java new file mode 100644 index 0000000..b04b24a --- /dev/null +++ b/Hello.java @@ -0,0 +1,19 @@ +class Vehicle{ + void run(){ + System.out.println("runn karti hai"); + } +} + +class Bike extends Vehicle{ + void run(){ + System.out.println("ye bhi chalti hai"); + } +} + +public class Hello{ + public static void main(String[] args){ + Vehicle obj=new Bike(); + obj.run(); + } + +} \ No newline at end of file From e62223427da1ff994888256a02833d9a2dc894f4 Mon Sep 17 00:00:00 2001 From: Anjali853 Date: Tue, 6 May 2025 22:18:46 +0530 Subject: [PATCH 02/12] first commit --- README.md | Bin 0 -> 36 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f916d0bbde68bbcd52fb9bb7762fb07d8be45ed9 GIT binary patch literal 36 lcmezWPnki1!HXf0p$v$18A2F}fOIB99vG)H@G@{Q005<62SWe= literal 0 HcmV?d00001 From 960dec236d0e9d8ad0048741d2657d3bb3ad243e Mon Sep 17 00:00:00 2001 From: Anjali853 Date: Tue, 6 May 2025 22:20:47 +0530 Subject: [PATCH 03/12] first commit --- README.md | Bin 36 -> 70 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/README.md b/README.md index f916d0bbde68bbcd52fb9bb7762fb07d8be45ed9..0bb44a6bdb96b77db3fe76b587d9a9852f0097c5 100644 GIT binary patch delta 7 OcmY#!o1ik0NeKW4-~rSC delta 4 LcmZ=$nV Date: Tue, 6 May 2025 22:58:56 +0530 Subject: [PATCH 04/12] 6th may --- BubbleSort.java | 3 +-- BubbleSort2.java | 26 ++++++++++++++++++++++++++ ClassObject.java | 21 +++++++++++++++++++++ Constructor.class | Bin 0 -> 343 bytes Inheritance.java | 32 ++++++++++++++++++++++++++++++++ Inheritance3.java | 27 +++++++++++++++++++++++++++ Inheritance6.java | 4 ++-- Main.java | 31 +++++++++++++++++++++++++++++++ Object.java | 19 +++++++++++++++++++ Overloading.java | 22 ++++++++++++++++++++++ Overloading2.java | 11 +++++++++++ Problem5.java | 27 +++++++++++++++++++++++++++ Question3.java | 5 +++++ SelectionSort.java | 2 +- Single.java | 26 ++++++++++++++++++++++++++ Strings.java | 4 ++-- Student.class | Bin 0 -> 962 bytes StudentClass.java | 40 ++++++++++++++++++++++++++++++++++++++++ StudentTest.java | 39 +++++++++++++++++++++++++++++++++++++++ add.java | 10 ++++++++++ stringBuilder.java | 5 ++++- thiskeyword.java | 19 +++++++++++++++++++ 22 files changed, 365 insertions(+), 8 deletions(-) create mode 100644 BubbleSort2.java create mode 100644 ClassObject.java create mode 100644 Constructor.class create mode 100644 Inheritance.java create mode 100644 Inheritance3.java create mode 100644 Main.java create mode 100644 Object.java create mode 100644 Overloading.java create mode 100644 Overloading2.java create mode 100644 Problem5.java create mode 100644 Question3.java create mode 100644 Single.java create mode 100644 Student.class create mode 100644 StudentClass.java create mode 100644 StudentTest.java create mode 100644 add.java create mode 100644 thiskeyword.java diff --git a/BubbleSort.java b/BubbleSort.java index 34a7d33..6d08677 100644 --- a/BubbleSort.java +++ b/BubbleSort.java @@ -1,8 +1,7 @@ import java.util.*; class BubbleSort { - - public static void printArray(int arr[]){ + public static void printArray(int arr[]){ for(int i=0; i arr[j+1]) { + //swap + int temp = arr[j]; + arr[j] = arr[j+1]; + arr[j+1] = temp; + } + } + } + printArray(arr); + } + } diff --git a/ClassObject.java b/ClassObject.java new file mode 100644 index 0000000..f0826d3 --- /dev/null +++ b/ClassObject.java @@ -0,0 +1,21 @@ +class Student{ +String firstname = "anjali"; +int age=19; + + +Student(String s, int a ) { + firstname=s; + age=a; + + System.out.println(firstname+ " "+ age); +} + + +} + +public class ClassObject{ + public static void main(String args[]){ + Student obj = new Student("anjali", 15); + Student obj1 = new Student("ayushi", 15); + } +} \ No newline at end of file diff --git a/Constructor.class b/Constructor.class new file mode 100644 index 0000000000000000000000000000000000000000..12152d11a66707e772a198170900f81ab74521a2 GIT binary patch literal 343 zcmZXQ!AiqG5QhIr({7ulHnz5&Ja}t7*axumQW1ophe$y@ZPKM|NH-8SzL%$hf)C(B ziL-jB;2!>&-I@OzW^7TRdLB(!Gn zTA)i1sckmO*e(JtOH;^F2M`DyWI&kCk^?5SwKm(UTjw1T`m4%3+q%hZRTKPGwNZp& zqK&$1cA2UlWLENvzmwWH($jxbye0%`)zrDV(XKiA!@P8pagHP2%N-BoHe-$WcE*u7 ywlDUeS564WtgZ}<(Zh)Kw>5_UgBZL+JdS$Nc#nQ^u(*E%CJ1rLh7-;`Ouhkg-9UW+ literal 0 HcmV?d00001 diff --git a/Inheritance.java b/Inheritance.java new file mode 100644 index 0000000..da5138f --- /dev/null +++ b/Inheritance.java @@ -0,0 +1,32 @@ +public class Inheritance{ + public static void main(String[] args) { + Puppy obj1 = new Puppy(); + obj1.cry(); + obj1.bark(); + obj1.lazy(); + + } +} + + + + +class Animal { + void cry(){ + System.out.println("cryingggggggg"); + } +} + + +class Dog extends Animal{ + void bark(){ + System.out.println("barkkkkkk"); + } +} + + +class Puppy extends Dog{ + void lazy(){ + System.out.println("cutieeeeeeee"); + } +} diff --git a/Inheritance3.java b/Inheritance3.java new file mode 100644 index 0000000..b87ef42 --- /dev/null +++ b/Inheritance3.java @@ -0,0 +1,27 @@ +public class Inheritance3{ + public static void main(String[] args) { + Monitor obj = new Monitor(); + obj.displayName(); + obj.displayClass(); + obj.checkDiscipline(); + + } +} + +class Person{ + void displayName(){ + System.out.println("anjali"); + } +} + +class Student extends Person{ + void displayClass(){ + System.out.println("i am in class"); + } +} + +class Monitor extends Student{ + void checkDiscipline(){ + System.out.println("discipline"); +    } +} diff --git a/Inheritance6.java b/Inheritance6.java index 1fe9113..81085d6 100644 --- a/Inheritance6.java +++ b/Inheritance6.java @@ -23,9 +23,9 @@ public class Inheritance6 { public static void main(String[] args) { Puppy myPuppy = new Puppy(); - + myPuppy.weep(); myPuppy.eat(); myPuppy.bark(); - myPuppy.weep(); +     } } \ No newline at end of file diff --git a/Main.java b/Main.java new file mode 100644 index 0000000..9656e10 --- /dev/null +++ b/Main.java @@ -0,0 +1,31 @@ + +class Animal { + void eat() { + System.out.println("This animal eats food."); + } +} + +// Derived class (inherits from Animal) +class Dog extends Animal { + void bark() { + System.out.println("The dog barks."); + } +} + +// Derived class (inherits from Dog) +class Puppy extends Dog { + void weep() { + System.out.println("The puppy weeps."); + } +} + +public class Main { + public static void main(String[] args) { + Puppy myPuppy = new Puppy(); + + + myPuppy.eat(); + myPuppy.bark(); + myPuppy.weep(); +    } +} \ No newline at end of file diff --git a/Object.java b/Object.java new file mode 100644 index 0000000..9c72598 --- /dev/null +++ b/Object.java @@ -0,0 +1,19 @@ +class Student { + String firstName="anjali"; + int age=19; + + + Student(String firstName,int age){ + this.firstName= firstName; + age=age; + + System.out.println(firstName+ " " + age); + } +} + +public class Object { + public static void main(String[] args) { + Student obj = new Student("anjali", 19); + Student obj1Student = new Student("ayushi", 15); + } +} \ No newline at end of file diff --git a/Overloading.java b/Overloading.java new file mode 100644 index 0000000..716c0ba --- /dev/null +++ b/Overloading.java @@ -0,0 +1,22 @@ +class parent{ + void sum(int a);{ + System.out.println("my name is anjaliii"+a); + } + + void sum(int a,int b){ + System.out.println(a+b); + } + void sum(int a, int b, int c){ + System.out.println(a+b+c); + } +} + + +class Overloading{ + public static void main(String[] args){ + parent obj =new parent(); + obj.sum(420); + obj.sum(420,20); + obj,sum(420,20,40); + } +} \ No newline at end of file diff --git a/Overloading2.java b/Overloading2.java new file mode 100644 index 0000000..3eeaad9 --- /dev/null +++ b/Overloading2.java @@ -0,0 +1,11 @@ +class Overloading2{ + int age=19; + void data(){ + System.out.println(this); + } + + public static void main(String[] args){ + Overloading2 obj=new Overloading2(); + obj.data(); + } +} \ No newline at end of file diff --git a/Problem5.java b/Problem5.java new file mode 100644 index 0000000..82d1d95 --- /dev/null +++ b/Problem5.java @@ -0,0 +1,27 @@ +class Shape { + public void area() { + System.out.println("displays area"); + } +} + +class Triangle extends Shape { + public void area(int l, int h){ + System.out.println(1/2*l*h); + } +} + +class EquilateralTriangle extends Triangle{ + public static void main(String[] args) { + System.out.println(1/2*l*h); + } +} + + + + + +public class Problem5{ + public static void main(String[] args) { + + } +} diff --git a/Question3.java b/Question3.java new file mode 100644 index 0000000..0fce719 --- /dev/null +++ b/Question3.java @@ -0,0 +1,5 @@ +public class Question3{ + public static void main(String[] args) { + + } +} \ No newline at end of file diff --git a/SelectionSort.java b/SelectionSort.java index d3dcfcc..88496ff 100644 --- a/SelectionSort.java +++ b/SelectionSort.java @@ -9,7 +9,7 @@ public static void printArray(int arr[]){ public static void main(String args[]){ int arr[] = {7,8,3,1,2}; - //bubble sort + //SelectionSort for(int i=0; iUCis!i;DuKMOv;pHhU^Ya_$U4i zy|76y`~m(b;~ADj8a7_c$DX{;JLk-v`Tghm7l3zo=^}xogOrC`NHY{J_$6=pT%9*R z^)JN0Fr;5gCCwX#WVP1IB7>|0*TZdiH{{)UXvBn6dPdMzXJI6D^K&4T>6$?BNh^aK zLuw?YbWy+^2SpE?C^2lts2QB8Wqn0<)yQv=7@0|R-m3LnY}?#-NZB>Bp-{#~c5Nx8 zB9(XF!yX`eGrw6z*=^F^8w?Lxzq2^kJzd{1lZXHnK|JroT2j#T2~Y|w@(Rw_aw$@8riQE9s=2H

a9@dCSl0n{kvOaK4? literal 0 HcmV?d00001 diff --git a/StudentClass.java b/StudentClass.java new file mode 100644 index 0000000..e697dc8 --- /dev/null +++ b/StudentClass.java @@ -0,0 +1,40 @@ + class Student{ + + String name="anjali"; + void sum(int a, int b){ + System.out.println(a+b); + } + } + + + class StudentClass{ + public static void main(String[] args){ + Student obj=new Student(); + Student obj1=new Student(); + obj.sum(5,5); + + + + + + class AreaOfRectangle{ + void AreaOfRectangle(int i int b);{ + System.out.println(a*b); + } + } + + public class StudentClass{ + public static void main(String args[]){ + Student obj=new Student(); + Student obj=new Student(); + obj.sum(5,3); + Area ar=new Area(); + ar.AreaOfRectangle(4,4); + } + } + } + + } + + + \ No newline at end of file diff --git a/StudentTest.java b/StudentTest.java new file mode 100644 index 0000000..eb0147d --- /dev/null +++ b/StudentTest.java @@ -0,0 +1,39 @@ + class Pen { + String color; + String type; + + public void write() { + System.out.println("writing something"); + } + public void printColor(){ + System.out.println(this.color); + + } + +} + +class Student { + String name; + int age; + + public void print + + Info(){ + System.out.println(this.name); + System.out.println(this.age); + } +} + + public class StudentTest { + public static void main(String args[]) { + Student s1 = new Student(); + s1.name = "anjali"; + s1.age = 19; + + + s1.printInfo(); + } + + + + } \ No newline at end of file diff --git a/add.java b/add.java new file mode 100644 index 0000000..be78062 --- /dev/null +++ b/add.java @@ -0,0 +1,10 @@ +public class add{ + public static void main(String[] args){ + + } + +} + +class addition{ + int sum(int a,int b) +} \ No newline at end of file diff --git a/stringBuilder.java b/stringBuilder.java index 0f7e4fc..9ff35e7 100644 --- a/stringBuilder.java +++ b/stringBuilder.java @@ -9,4 +9,7 @@ public static void main(String[] args) { System.out.println(sb); } -} \ No newline at end of file +} + + + diff --git a/thiskeyword.java b/thiskeyword.java new file mode 100644 index 0000000..b46b04d --- /dev/null +++ b/thiskeyword.java @@ -0,0 +1,19 @@ +class Student{ + int age; + Student(int age){ + this.age=age; + } + void print(){ + System.out.println(age); + } +} + +public class thiskeyword{ + + public static void main(String[] args){ + + + Student obj=new Student(16); + obj.print(); + } +} \ No newline at end of file From d42d9546a0c94010a29deddf7ffcd53c41168495 Mon Sep 17 00:00:00 2001 From: Anjali853 Date: Tue, 6 May 2025 23:49:27 +0530 Subject: [PATCH 05/12] Overloading --- add.java | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/add.java b/add.java index be78062..3d9080a 100644 --- a/add.java +++ b/add.java @@ -1,10 +1,28 @@ public class add{ public static void main(String[] args){ + addition obj = new addition(); + + + obj.sum(5, 10); + obj.sum(3, 7, 2); + //obj.sum(4, 5, 3.2); } } class addition{ - int sum(int a,int b) -} \ No newline at end of file + void sum(int a, int b){ + System.out.println("Sum of two integers:" + (a + b)); + + } + + void sum(int a, int b, int c){ + System.out.println("Sum of three integers:" + (a+b+c)); + } + + void sum(double a, double b){ + System.out.println("Sum of two doubles:" + (a+b)); + } + +} From 41805dfea912428b44e988c6fd51e997c83921e7 Mon Sep 17 00:00:00 2001 From: Anjali853 Date: Wed, 7 May 2025 11:33:41 +0530 Subject: [PATCH 06/12] overriding --- overriding.java | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 overriding.java diff --git a/overriding.java b/overriding.java new file mode 100644 index 0000000..4e81c00 --- /dev/null +++ b/overriding.java @@ -0,0 +1,30 @@ +abstract class Animal{ + + abstract void sleep(int a); + void Sound(){ + System.out.println("pet animal"); + + } + +} + +class Cat extends Animal{ + void sleep(int a){ + System.out.println("number of cats"+a); + } +} +class Dog extends Animal{ + void sleep(int a){ + System.out.println("number of dogs"+a); +} +} + +class overriding { + public static void main(String[] args){ + Animal obj=new Cat(); + obj.sleep(5); + Animal obj1 =new Dog(); + obj1.sleep(10); + obj1.Sound(); + } +} \ No newline at end of file From fa85f7c61e6cd4f318e55d04c208c9e2e6723e61 Mon Sep 17 00:00:00 2001 From: Anjali853 Date: Wed, 7 May 2025 11:38:20 +0530 Subject: [PATCH 07/12] polymorphism --- polymorphism.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 polymorphism.java diff --git a/polymorphism.java b/polymorphism.java new file mode 100644 index 0000000..bd9ad1b --- /dev/null +++ b/polymorphism.java @@ -0,0 +1,15 @@ +class polymorphism{ + public static void main(String[]args){ +Parent obj = new Parent(); +//obj.sumgi(10); +obj.sum(10,45); + } +} +class Parent{ + void sum(int a){ + System.out.println(a); + } +void sum(int a,int b) { + System.out.println(a+b); + +}} From bc8cc46385ed29a3a7a601796e26da0e65ca4352 Mon Sep 17 00:00:00 2001 From: Anjali853 Date: Wed, 21 May 2025 00:20:07 +0530 Subject: [PATCH 08/12] countfrequency --- count_frequency.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 count_frequency.java diff --git a/count_frequency.java b/count_frequency.java new file mode 100644 index 0000000..215ce12 --- /dev/null +++ b/count_frequency.java @@ -0,0 +1,18 @@ +public class count_frequency { + public static void main(String[] args) { + String str = "aaabbccccddddd"; + StringBuilder newStr = new StringBuilder(); + int count = 1; + for (int i = 0; i < str.length() - 1; i++) { + if (str.charAt(i) == str.charAt(i + 1)) { + count++; + // System.out.println(str.charAt(i)); + } else { + newStr.append(str.charAt(i)).append(count); + count = 1; + } + } + newStr.append(str.charAt(str.length() - 1)).append(count); + System.out.println(newStr); + } +} \ No newline at end of file From 014f513cd44dea6b03681561a0a0e3e47dada5de Mon Sep 17 00:00:00 2001 From: Anjali853 Date: Thu, 22 May 2025 13:18:44 +0530 Subject: [PATCH 09/12] try catch --- exception2.java | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 exception2.java diff --git a/exception2.java b/exception2.java new file mode 100644 index 0000000..33a57dc --- /dev/null +++ b/exception2.java @@ -0,0 +1,29 @@ +// public class exception2{ +// public static void main(String[] args) { +// int[] arr={2,1,2,34}; +// try { +// System.out.println(arr[6]); + +// } catch (Exception e) { +// System.out.println(e); +// } +// System.out.println("hello"); +// } +// } + + +public class exception2{ + public static void main(String[] args) { + String str= null ; + System.out.println(str.toUpperCase()); + try { + + } catch (Exception e) { + System.out.println(e); + + } + } +} + + + From f1e92d07979028278c9515dbdca0c2f2ba8edb68 Mon Sep 17 00:00:00 2001 From: Anjali853 Date: Thu, 22 May 2025 23:44:15 +0530 Subject: [PATCH 10/12] subarray --- subarray.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 subarray.java diff --git a/subarray.java b/subarray.java new file mode 100644 index 0000000..5e3dc5c --- /dev/null +++ b/subarray.java @@ -0,0 +1,18 @@ +public class subarray{ + public static void main(String[] args) { + int n =5; + int arr[]={1,2,3,4,5}; + for(int str=0; str Date: Fri, 23 May 2025 12:47:23 +0530 Subject: [PATCH 11/12] arraylist --- arrayList.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 arrayList.java diff --git a/arrayList.java b/arrayList.java new file mode 100644 index 0000000..acdb123 --- /dev/null +++ b/arrayList.java @@ -0,0 +1,15 @@ +import java.util.ArrayList; +public class arrayList{ + public static void main(String[] args){ + ArrayList arr=new ArrayList<>(); + arr.add("anjali"); + arr.add("priyanshi"); + arr.add("disha"); + arr.add("sneha"); + arr.add("friends"); + arr.set(3,"yoyo"); + System.out.println(arr); + + } + +} \ No newline at end of file From 0eb1f9ca63816b704c93ebdc80eea274fc153787 Mon Sep 17 00:00:00 2001 From: Anjali853 Date: Fri, 23 May 2025 12:56:12 +0530 Subject: [PATCH 12/12] ac --- Abstract.java | 12 ++++++++++++ Animal.class | Bin 0 -> 419 bytes Area.class | Bin 0 -> 971 bytes ButterflyPattern.class | Bin 0 -> 795 bytes Dog.class | Bin 0 -> 822 bytes Happy.java | 28 ++++++++++++++++++++++++++++ Overloading.java | 4 ++-- Overloading4.class | Bin 0 -> 390 bytes Overloading4.java | 19 +++++++++++++++++++ Parent.class | Bin 0 -> 422 bytes Problem5.java | 8 +------- Question.java | 21 --------------------- Question2.java | 19 ------------------- Question3.java | 5 ----- Shape.class | Bin 0 -> 395 bytes Triangle.class | Bin 0 -> 362 bytes add.java | 3 ++- arrayList.class | Bin 0 -> 723 bytes arrayList.java | 2 ++ count_frequency.class | Bin 0 -> 839 bytes ex.java | 1 + exception.java | 13 +++++++++++++ exception2.java | 26 ++++++++++++++++++++------ exception3.java | 26 ++++++++++++++++++++++++++ myapp/Person.java | 15 +++++++++++++++ myapp/main.java | 20 ++++++++++++++++++++ overriding.class | Bin 0 -> 399 bytes polymorphism.class | Bin 0 -> 334 bytes subarray.class | Bin 0 -> 1029 bytes subarraysum.java | 26 ++++++++++++++++++++++++++ 30 files changed, 187 insertions(+), 61 deletions(-) create mode 100644 Abstract.java create mode 100644 Animal.class create mode 100644 Area.class create mode 100644 ButterflyPattern.class create mode 100644 Dog.class create mode 100644 Happy.java create mode 100644 Overloading4.class create mode 100644 Overloading4.java create mode 100644 Parent.class delete mode 100644 Question.java delete mode 100644 Question2.java delete mode 100644 Question3.java create mode 100644 Shape.class create mode 100644 Triangle.class create mode 100644 arrayList.class create mode 100644 count_frequency.class create mode 100644 ex.java create mode 100644 exception.java create mode 100644 exception3.java create mode 100644 myapp/Person.java create mode 100644 myapp/main.java create mode 100644 overriding.class create mode 100644 polymorphism.class create mode 100644 subarray.class create mode 100644 subarraysum.java diff --git a/Abstract.java b/Abstract.java new file mode 100644 index 0000000..d493809 --- /dev/null +++ b/Abstract.java @@ -0,0 +1,12 @@ +import myapp.main; + +abstract class aminal{ + void makesound(); +} + +public class Abstract { + public static void main(String[] args) { + + } + +} diff --git a/Animal.class b/Animal.class new file mode 100644 index 0000000000000000000000000000000000000000..5fdb1fd6e4582e919948e325e2ee3419284a6226 GIT binary patch literal 419 zcmZvZ-AV&75QR_LZPTu+TU+aYr8h$Bg?)gEAc`Oq6;}2>+lG>|n=NTt@Uiql!3!V2 zhY}|%D1w1xPBLdchRMh0+dF_O9Qi1r%;5#7pvusgiIo_nLQe;G$xMzdL-kB)WzQMP zy?$Ir4RsDbz#4)-_ULh8Wk#-iNk#2Z0aE$k-Y9J&Yoy4AHEb~Wb7{Lmt4yRm8rbA$ z254c6q4iG<1D`uWstMZrrWWlHQt9ciA9HL|lNSY$!Mn^Sk|7)^EpL}uBF%$HQhKQ@ zQYq(T=-u>Vx<>g@PpBJ;W-PCj^Mv_I8lxrzK6Sl#U9@RFZk1`%gut*vszZ^vmy=hp tClU<1bhAsEpvb1=rwS%9Fi`f^9AC-QHB5j literal 0 HcmV?d00001 diff --git a/Area.class b/Area.class new file mode 100644 index 0000000000000000000000000000000000000000..9c3e5988a5c8e406cb5075ca17cb6aad58e30e21 GIT binary patch literal 971 zcmaJ=U2hUW6g^Wu7H|U=THC6vRH;B~yM9z3#26LQ)P!0i1Rs1Fma%MEcF68P!awnE z=z}JG@CW#pOpJF}3^XNfvUBg=Ip^LpckcfBbMX^E4bM_oLc~DSL=16;>*svLEth*| z)@l1(*oq!EJFkx~W9=YtcWy0Q}_ zP^73XmY1LNw&UBbc+L_i(-HnfKhP!6b?A*u9D6A|z`lV4-6)HpFl(mcjbu+)VMoH= z9dTPpf6VY@{=idUsNtA<9ajW}x|F@)pmMb@bCFBL=6E0$z(395!wIU)-`6xnmAh`k zQKG_NzV$reS6vX1qocji21({;6*t@_o@Exl&qW+z9jVz)Q^4%$UkH|5K sWQbfW6Yznl@=6?oXDaLnEdRX)^%o6rgHQg~Wg^saqTzr!tpHomeV$ zVq;{14lq%{P$UNa0R9#R=BiNMxn%%_4WH!q-F@$S-;cYmKR#2?xG<3s z$am$wtc5b#t=(^T{f-jItOik_8UpD`bt?-SSqqMf5x9TQTL;gS-y^F(U{JA{2nGGx zMjS+{rD9+9>NZ9N#FB$N#w`?FOkh%AVhB~h+|z+ns$5DXHBl#scI(wG8zm~uYo%!y z*L3Mt5)eif$}H^GKq)`o2@f`;HX;Gzc7NL!7;6TRe{axh`|$(W4tZkqWI%tZ@@QBl zfm}<;&eOYc?~3oV`h&RRuLnA~_;;dZ-3=CSorBe13hV_L{ypwyh=OP?eS-KvL+}WR zTiaR8Vvb0v2w`vmC-$nb=9Q1JX*6cMV~l@@Y3fUVP`FS@yP{Tsexr9p8qs z8GDMU!xSS=%4?qS`oF4PP*pdTN}B3&20)rSlZ{!tDjUBNr`8ei1xNFe>aU1zII4H#zQ-cwnW>Ka4;Vt6^EI5Ia1KEz TT|(guBij0xk27CL3SayMCM>Q0 literal 0 HcmV?d00001 diff --git a/Dog.class b/Dog.class new file mode 100644 index 0000000000000000000000000000000000000000..5f9ca24f0a70c8a87ba60da91100049f340710a3 GIT binary patch literal 822 zcmaJ{L3u14+N%vg~UN>41qX7}Po>h{N6D%-QU;Ayl$k!}R2 zqQHRSe_w5Mbl%at|6Z5@XNy%4sfFp7L^pzh&TfKA+Hs4vlH@G=)IQBGu0 zBJ6v(Lm3|G5yMJH$AY2Sl}fyyqyv$k@IgYJRg(yj5rER@Gx$9{$%o=dy1S~LiaeJw zC3N5tpbosz+8Uel?47WuIyMzNB%HcXZ0IkISdR>=mhsp}6MG(>xcZ+mG_P7G)l`o~ zo0>$rMN5wO(CU1~@O8e9OJEV{Emv_OOtY)?c#=hn<<5EjA)d@Ku>}5k4*y|rCWbbe ze}+qm4o{Mvv?5{%j+GL5C*j5j<6)m+Z=t4Tsd{+Mu={@~ja^X}8rY)2bf4R4G{LY< z)_ppe^X&fw`$h)CUE19>P@}bjdt^IkNK{8&{|;~G9P7Xj+`OW=!3RxOfI3Q~>mu#q W0i6{Rctop#7XA5Tg?NS+*!~N+ZqF_N literal 0 HcmV?d00001 diff --git a/Happy.java b/Happy.java new file mode 100644 index 0000000..64e8438 --- /dev/null +++ b/Happy.java @@ -0,0 +1,28 @@ + abstract class Payment{ + + abstract void pay(int a); + void succes(){ + System.out.println("paymemt done"); + } + +} + +class UpiPayment extends Payment{ + void pay(int a){ + System.out.println("upi via payment"+a); + } +} +class Netbanking extends Payment{ + void pay(int b){ + System.out.println("netbanking via payment"+b); +} +} +class Happy { + public static void main(String[]args){ + Payment obj=new UpiPayment(); + obj.pay(23000); + Payment obj1 =new Netbanking(); + obj1.pay(56000); + obj1.succes(); + } +} \ No newline at end of file diff --git a/Overloading.java b/Overloading.java index 716c0ba..fa978d2 100644 --- a/Overloading.java +++ b/Overloading.java @@ -1,5 +1,5 @@ class parent{ - void sum(int a);{ + void sum(int a){ System.out.println("my name is anjaliii"+a); } @@ -17,6 +17,6 @@ public static void main(String[] args){ parent obj =new parent(); obj.sum(420); obj.sum(420,20); - obj,sum(420,20,40); + obj.sum(420,20,40); } } \ No newline at end of file diff --git a/Overloading4.class b/Overloading4.class new file mode 100644 index 0000000000000000000000000000000000000000..fd8cc0108528a0730af2c36c8c889fd3a2c5705d GIT binary patch literal 390 zcmYjMO-lk%6g_V~bsC#V%*wI|T8ss`X;+Amw31vH1JUY@K4e5^U{L>88-;>?KtC!v z4;OYH+;cz9Io$X2`}qx^hYJq|Oc$098;(FYl`Gkv$!yXdBvUn72sjUEmM%I1X4HyZ zlmx8DLP-xUOs9KA8;0&GKK2oCEx9H{y;kgW{Vl=ihTB3j4>hwcU`IW2TpSDdgOw^~ zxg4k2Q2G0Kgh`T)k literal 0 HcmV?d00001 diff --git a/Overloading4.java b/Overloading4.java new file mode 100644 index 0000000..11f4c43 --- /dev/null +++ b/Overloading4.java @@ -0,0 +1,19 @@ +class Area { + void area(double radius){ + System.out.println("Area of circle:" + (Math.PI * radius * radius )); + } + void area(double length, double width){ + System.out.println("Area of Rectangle:" + (length* width)); + } + +} + +public class Overloading4 { + public static void main(String[] args){ + Area obj = new Area(); + + obj.area(10.0); + obj.area(3.5, 4); + + } +} \ No newline at end of file diff --git a/Parent.class b/Parent.class new file mode 100644 index 0000000000000000000000000000000000000000..ffcdd8d748f92878b4367d221700c21556c8897d GIT binary patch literal 422 zcmZut+e*Vg5Ix(Z-8QDC7w=W@p-Ae3`2fWiMJN<4MEdNeF1jVjhFpYxmOd!>;0O3o z;;aZFbYXXgnRA($&#(6n0GAjzsKMf}UDVNF=q$vO2x5^w1UJz_&P#^InMzf8&S3eY zSqn|HI2;#iaR0%>Wl_q6P`V=0=Hy36>0p|xv<%B!isaP6Iy{b!i!OQ${S_Dno*71* zGT8ojG~?Ky9;PCfDe2l5`d%`46P3#ADv4x%E25Y(R#B08-5(Q$!3lMh&*haerEaF< zWuo)!Q5DIF@x&qeG`BexU78%!GDQdUGm|-f1AC@`VT)c<22BoZqeroU4oSdBG+)36 nuW0|F%}N0WoOWawJHL!0GBb9LVeH?n;Iz?#N9bKb)v)&s_+?1w literal 0 HcmV?d00001 diff --git a/Problem5.java b/Problem5.java index 82d1d95..0ea6d53 100644 --- a/Problem5.java +++ b/Problem5.java @@ -12,16 +12,10 @@ public void area(int l, int h){ class EquilateralTriangle extends Triangle{ public static void main(String[] args) { - System.out.println(1/2*l*h); + } } - -public class Problem5{ - public static void main(String[] args) { - - } -} diff --git a/Question.java b/Question.java deleted file mode 100644 index 1497b32..0000000 --- a/Question.java +++ /dev/null @@ -1,21 +0,0 @@ -public class Question { - - public static void main(String args[]){ - int[] arr = {23,4,12,78,56,43,98,1}; - - int min = arr[0]; - int max = arr[0]; - - for(int i = 1; i max){ - max = arr[i]; - } - } - System.out.println("Mininum element:" + min); - System.out.println("Maximum element:" + max); - - } -} \ No newline at end of file diff --git a/Question2.java b/Question2.java deleted file mode 100644 index e3ee396..0000000 --- a/Question2.java +++ /dev/null @@ -1,19 +0,0 @@ -public class Question2 { - - public static void main(String args[]){ - int[] arr = {1,2,3,4,5}; - int[] reversed = new int[arr.length]; - - for (int i = 0; i < arr.length; i++){ - reversed[i] = arr[arr.length-1-i]; - } - - System.out.println("Reversed array" ); - for(int i = 0; i< reversed.length;i++){ - System.out.print(reversed[i] + " "); - } - - - - } -} \ No newline at end of file diff --git a/Question3.java b/Question3.java deleted file mode 100644 index 0fce719..0000000 --- a/Question3.java +++ /dev/null @@ -1,5 +0,0 @@ -public class Question3{ - public static void main(String[] args) { - - } -} \ No newline at end of file diff --git a/Shape.class b/Shape.class new file mode 100644 index 0000000000000000000000000000000000000000..486cf8d6da3f956a6fecea8f1c08aab1f56ed025 GIT binary patch literal 395 zcmZut%Sr=55UkE_ve|Xl#Kia(auE^_?#WZci{dG0U?un2WQY^?#Xf|5mL3#5_yK;D z*b_k!oI`g}U0prY$LHHSfNLB%sKKycx~QW;XfMU1@FS5d{JU@|XCX$Re>S`hrOZZERWS zxaeY=(EVqPU}f4QO4xVsZM^;=yQ*X{8cr?j5bD8$$RxqMO6S~KW0lC;Dh_3SFTzL< z^gV(Tq*XqXH%fEfBu{x5pP%W&=%dGZ=%*_u0>Un%WA3Dx(^t?F1Hv9xJ=U18|06x& bRn6MZusYrgTEB9gHDGXrCQA+&*Kqg+a{5hd literal 0 HcmV?d00001 diff --git a/Triangle.class b/Triangle.class new file mode 100644 index 0000000000000000000000000000000000000000..43c818b48afbe4660e87d456a8ee19f2644fface GIT binary patch literal 362 zcmZut%Sr=55UkE_GTC)wqVXLCj~fr!lPATCA_Rg2Hsn6h!5!I07-t1POAiq|_yK;D z*prJFr=hx;s-hp?Kc8O!ZZHVZfG6NbXre`ErkPwSLhDkO+FlX7csLKxMj#MI*g!<+ zJ;@iDA+%>kbCaCM@vo}~PTh$v)m>dIl$puJnvmRs$BxJBB7|vGn|pPu9oLzfibciw z$hE{N`n;=q4tZPf#9W5<7|b_pTnIJ O2>3`L>kqkZ;OG}c$3ZXv literal 0 HcmV?d00001 diff --git a/add.java b/add.java index 3d9080a..e648225 100644 --- a/add.java +++ b/add.java @@ -5,7 +5,8 @@ public static void main(String[] args){ obj.sum(5, 10); obj.sum(3, 7, 2); - //obj.sum(4, 5, 3.2); + // + obj.sum(4, 5, 3.2); } diff --git a/arrayList.class b/arrayList.class new file mode 100644 index 0000000000000000000000000000000000000000..e56ec2c746896f02a01f21ce4057334bdd36a619 GIT binary patch literal 723 zcmZ`%+iuf95Ix&CvE#Z;>ymH{(9(-jLk$#O8ia&ENJvpZN|g$D+QdtvuDoCobivJU%vx*fyXxHP%&XRsG`QOG~u6k5OH-BydF-( zC}XHSkxFJy87f|9V8UWpDM5KAqu^PR@S-Qv%!Y}Ig?YkrHQ|xefdvPPXiz2(Lx!f; z`^QMDaxJ|93f@a#fF#li5I@WN<#JYnGY@So6U!<9s5?`DXU-KkY z#=)CJs;r+Sf=|0PJakNKJMeM$RJQXNYL`Y=S)~4>4=KJwD)3XCX{6_IC>R<&slx1*PWRotULL4R|g1)xS} zKwg_HBU{}*2K!7GhWm8tXAQ060Upv_LsL{ritaaKbLhKEC&n#};a-}d z<-1o)uj*c(p?&xTtNsjIzYA;NhrGmy6OcSgzX;PG=1YF!t-+ihKUO?c;r z7+-kShmvUGs|i2J2k}lfMrvd>nLB&$Ip>}`nUh~%zXN!Ldub$K2yhEYOfcm3s1W`7Xnf zT`x7yX}_Tvi<+^dfsONlCNAN!z!eM2xH|6f;C-liWUU{Ok3!ta>sPmF%#a39vPW&M z}koQoT;O2C{fb@6*9Fs>E0TKc(NK Wz#V~%fXQg0<=jt_U_{jNcYgzDX|&z| literal 0 HcmV?d00001 diff --git a/ex.java b/ex.java new file mode 100644 index 0000000..fd6069e --- /dev/null +++ b/ex.java @@ -0,0 +1 @@ +public class except \ No newline at end of file diff --git a/exception.java b/exception.java new file mode 100644 index 0000000..f3bfa3b --- /dev/null +++ b/exception.java @@ -0,0 +1,13 @@ +public class exception{ + public static void main(String[] args) { + int a=10; int b=0; + try { + int c=a/b; + } catch (Exception e) { + System.out.println("we can not divide by zero"); + + } + System.out.println("hello cc"); + System.out.println("hii ac"); + } +} \ No newline at end of file diff --git a/exception2.java b/exception2.java index 33a57dc..44ed392 100644 --- a/exception2.java +++ b/exception2.java @@ -12,18 +12,32 @@ // } +// public class exception2{ +// public static void main(String[] args) { +// String str= null ; +// System.out.println(str.toUpperCase()); +// try { + +// } catch (Exception e) { +// System.out.println(e); + +// } +// } +// } + + + + public class exception2{ public static void main(String[] args) { - String str= null ; - System.out.println(str.toUpperCase()); + int[]arr= {1,2,3}; try { - + System.out.println(arr[5]); } catch (Exception e) { - System.out.println(e); - + System.out.println("Exception occurred:" +e); } + System.out.println("End of program"); } } - diff --git a/exception3.java b/exception3.java new file mode 100644 index 0000000..7351d20 --- /dev/null +++ b/exception3.java @@ -0,0 +1,26 @@ +// public class exception3{ +// public static void main(String[] args) { +// String s= null; +// try { +// System.out.println(s.length()); + + +// } finally { +// System.out.println("finally block executed"); + +// } +// } +// } + + +public class exception3{ + public static void main(String[] args) { + int[] arr={1,-2,3,4,-5}; + int + int smallest = arr[0]; + int temp = 0; + int secsmallest=arr[1]; + for(int i=0;i4q$6x26{U%NIx_@dNxQ zj_^7j?7Do+L{h zIyhqB$x5cF3YDIdY?OqOq2?gV^IWGShx`crZt!*nL^ zlp)u0%S*#X7Y%x>IVRF`!Ej8dLz$V*`3CHR0K*AIGX_a2Xre{fP<``Tl)GCvFB??+ ri}D(L3y+HZhk?hb8mw`UyEMrMq%D(Ym7MD2)j}I*e{0(`E1>fWL7_uR literal 0 HcmV?d00001 diff --git a/polymorphism.class b/polymorphism.class new file mode 100644 index 0000000000000000000000000000000000000000..b325a897a9e364db223485141c42565b4e4e7761 GIT binary patch literal 334 zcmYjMO-sW-5Pj36O}oZ6^`kezW2$KJZ0SW23PFWRK|F2hQnw_VvP}ekmKO^O{s4cJ zINM8In3=aT@6GUjem}nfT%#vYgBQRLQAdLiE##{lWYWwBcj-dSN$92>iLp+n+?t_Uw4l99vBrd_rM}d+}LV0aUN^V3%j+cMo zJFY4#Uy5d7gwDK{z#xVg#+#xpi=JB(>XoDR$qSTlRY19!Qnr&G)j_$AyH~IDm^ z2_!MbFxrEkL2repg%no_vfClWL;{ncP#z&0E=P*N4BA!U`{IZ}D|)+N4NyOs9wIqNY5b1ia~% zegW)|KNIe5Lk9C3o>yd<0)g>bX-404Eqe*4g{tKPh;E@nenrAIEW;zl9aVq6%{KF9C5{X;ivS0t~u& zj%BK;NVY`#HpO1j-VTN_OXw7gb4)RgIra;jhRM#5Iz#^%f#SFok