├── Exception Handling ├── Readme.md ├── 10_2_1 KeywordsExceptionHanlding │ └── ExceptionHandlingDemo1.java ├── 10_4 Hierarchy of Exceptions │ ├── ExceptionMethodsDemo.java │ └── GetCauseMethodDemo.java ├── 10_2_2 KeywordsExceptionHanlding │ ├── ExceptionHandlingDemo2.java │ └── ExceptionHandlingDemo3.java ├── 10_3 try catch finally InDetail │ ├── checkedException.java │ └── TryCatchFinallyInDetailDemo.java ├── 10_1 BasicsExceptionHandling │ └── BasicsExceptionHandlingDemo.java ├── 10_5 TypesOfException │ └── TypesOfExceptionDemo.java └── 10_6 Custom Exception │ └── CustomExceptionDemo1.java ├── Packeage in Java ├── Readme.md ├── 9_2 serDefindPackagesInJava │ ├── static_impot_demo.java │ ├── UserDefinedPackageDemo.java │ └── UserDefinedPackageDemo3.java ├── mypack │ └── UserDefinedPackageDemo2.java └── 9_1 PackagesInJava │ └── builtin_package_demo.java ├── CollectionFramework ├── Readme.md ├── 11_5 Collection Framework - SortedSet Interface │ ├── Student.class │ ├── SortedSetDemo.class │ └── SortedSetDemo.java ├── 11_7 Collection Framework - SortedMap Interface │ └── SortMapDemo.java ├── 11_6_2 CollectionFramework MapInterface - Demo │ └── MapDemo.java └── 11_3 ArrayList And Linked List │ └── ListInterfaceDemo.java ├── Methods in Java ├── Readme.md ├── 5_4 RecursiveMethods │ ├── recursive_demo.java │ └── factorial_demo.java ├── 5_3 MethodOverloading │ ├── promotion_demo.java │ ├── overloading_demo.java │ └── function_overloading_demo.java └── 5_2 DemonstratingMethods │ ├── func_prime_check.java │ ├── func_call_demo.java │ └── prime_check.java ├── Abstract and Interface ├── Readme.md ├── 8_3 Interface │ ├── interface_demo2.java │ └── interface_demo1.java ├── 8_5 ComparingAbstractClassAndInterface │ ├── abstract_interface_demo.java │ └── abstract_interface_demo_2.java ├── 8_2 AbstractAndFinal │ ├── absract_final_demo1.java │ └── absract_final_demo2.java ├── 8_1 AbstractClassAndMethods │ └── abstract_demo.java └── 8_4 PracticalDemonstrationInterface │ └── interface_demo3.java ├── java lab ├── Ex.No 1.docx ├── Ex.No 2.docx ├── Ex.No 3.docx ├── Ex.No 4.docx ├── Ex.No 5.docx ├── Ex.No 6.docx ├── Ex.No 8.docx ├── Ex.No 9.docx ├── Ex.No 10.docx └── Ex.No 11.docx ├── Readme.md ├── Operators ├── Method in java.md ├── Logicaloperators │ ├── ShiftOperator │ │ ├── src │ │ │ └── Main.java │ │ └── ShiftOperator.iml │ ├── Logicaloperators.iml │ └── src │ │ └── LogicalOperatorDemo.java ├── AssignmentOperators │ ├── src │ │ ├── SimpleAssignmentOperator.java │ │ ├── Main.java │ │ └── CompoundAssignmentOperator.java │ └── AssignmentOperators.iml ├── BitwiseOperators │ ├── src │ │ ├── BitwiseANDDemo.java │ │ ├── BitwiseORDemo.java │ │ ├── BitwiseXORDemo.java │ │ ├── Main.java │ │ └── BitwiseComplementDemo.java │ └── BitwiseOperators.iml ├── UnaryOperator │ ├── src │ │ ├── UnaryMinus.java │ │ ├── NotOperator.java │ │ ├── Main.java │ │ ├── BitwiseComplement.java │ │ ├── Decrement.java │ │ └── IncrementOperator.java │ └── UnaryOperator.iml ├── ShiftOperators │ ├── src │ │ ├── UnsignedRightShift.java │ │ ├── Main.java │ │ ├── SighnedLeftShift.java │ │ └── ShinedRightShift.java │ └── ShiftOperators.iml ├── Operators.iml ├── TernaryOperator │ ├── TernaryOperator.iml │ └── src │ │ └── TernaryOperator.java ├── RelationalOperator │ ├── RelationalOperator.iml │ └── src │ │ ├── Main.java │ │ └── RelationalOperatorDemo.java ├── ArithmeticsOperators │ ├── ArithmeticsOperators.iml │ └── src │ │ └── ArithmecsOperatorDemo.java ├── src │ └── Main.java ├── Operator in Java └── Readme.md ├── Fundamentals Of Java ├── src │ ├── Main.java │ ├── TypeCastingExample.java │ ├── ReadingInputFromUser.java │ └── VariavleAndDataTypesDemo.java └── Fundamentals Of Java.iml ├── Object and Classes ├── 6_8 WrapperClass │ ├── wrapper_demo3.java │ ├── wrapper_demo2.java │ ├── wrapper_demo4.java │ └── wrapper_demo1.java ├── 6_5 thisKeyword │ └── this_demo.java ├── 6_7 InitializerBlocks │ ├── initializer_block_demo.java │ └── static_initializer_block_demo.java ├── 6_4 ConstructorsInJava │ └── constructor_demo.java ├── 6_2 AccessModifiersInJava │ └── access_modifier_demo.java ├── 6_6 staticsKeyword │ └── static_demo.java ├── 6_3 ArrayOfObjects │ └── array_refernce_demo.java ├── 6_1 DeclarationOfClassAndObjects │ └── class_demo.java └── Readme.md ├── Inheritance ├── 7_7_3 ObjectClassAndMethods-Part III │ ├── get_class_demo.java │ └── finalize_demo.java ├── 7_3 superKeyword │ └── super_demo.java ├── 7_5 MethodOverridingInJava │ ├── method_ovreriding_demo1.java │ └── method_ovreriding_demo2.java ├── 7_6 finalKeywordInJava │ └── final_demo1.java ├── 7_4_2 constrcutorInInheritance Part 2 │ ├── constructor_call_demo2.java │ └── constructor_call_demo.java ├── 7_7_1 ObjectClassAndMethods-Part I │ ├── to_string_demo.java │ ├── hash_code_demo.java │ └── equals_demo.java ├── 7_7_2 ObjectClassAndMethods-Part II │ ├── clone_demo.java │ └── clone_demo2.java ├── 7_4_1 constrcutorInInheritance Part 1 │ └── constructor_call_demo.java ├── 7_1_1 Inheritance-ConceptAndSyntax │ └── inheritance_demo1.java ├── 7_2 TypeOfInheritance │ └── inheritance_demo2.java └── Readme.md ├── README.md └── LICENSE /Exception Handling/Readme.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Packeage in Java/Readme.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CollectionFramework/Readme.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Methods in Java/Readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Abstract and Interface/Readme.md: -------------------------------------------------------------------------------- 1 | #Inheritance in Java -------------------------------------------------------------------------------- /java lab/Ex.No 1.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bholuvivek/Java/HEAD/java lab/Ex.No 1.docx -------------------------------------------------------------------------------- /java lab/Ex.No 2.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bholuvivek/Java/HEAD/java lab/Ex.No 2.docx -------------------------------------------------------------------------------- /java lab/Ex.No 3.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bholuvivek/Java/HEAD/java lab/Ex.No 3.docx -------------------------------------------------------------------------------- /java lab/Ex.No 4.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bholuvivek/Java/HEAD/java lab/Ex.No 4.docx -------------------------------------------------------------------------------- /java lab/Ex.No 5.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bholuvivek/Java/HEAD/java lab/Ex.No 5.docx -------------------------------------------------------------------------------- /java lab/Ex.No 6.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bholuvivek/Java/HEAD/java lab/Ex.No 6.docx -------------------------------------------------------------------------------- /java lab/Ex.No 8.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bholuvivek/Java/HEAD/java lab/Ex.No 8.docx -------------------------------------------------------------------------------- /java lab/Ex.No 9.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bholuvivek/Java/HEAD/java lab/Ex.No 9.docx -------------------------------------------------------------------------------- /java lab/Ex.No 10.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bholuvivek/Java/HEAD/java lab/Ex.No 10.docx -------------------------------------------------------------------------------- /java lab/Ex.No 11.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bholuvivek/Java/HEAD/java lab/Ex.No 11.docx -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | #Method in Java 2 | - In this section how to create method in java 3 | - Return type method -------------------------------------------------------------------------------- /Operators/Method in java.md: -------------------------------------------------------------------------------- 1 | #Method in Java 2 | - In this section how to create method in java 3 | - Return type method -------------------------------------------------------------------------------- /Fundamentals Of Java/src/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | System.out.println("Hello world!"); 4 | } 5 | } -------------------------------------------------------------------------------- /Operators/Logicaloperators/ShiftOperator/src/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | System.out.println("Hello world!"); 4 | } 5 | } -------------------------------------------------------------------------------- /CollectionFramework/11_5 Collection Framework - SortedSet Interface/Student.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bholuvivek/Java/HEAD/CollectionFramework/11_5 Collection Framework - SortedSet Interface/Student.class -------------------------------------------------------------------------------- /CollectionFramework/11_5 Collection Framework - SortedSet Interface/SortedSetDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bholuvivek/Java/HEAD/CollectionFramework/11_5 Collection Framework - SortedSet Interface/SortedSetDemo.class -------------------------------------------------------------------------------- /Packeage in Java/9_2 serDefindPackagesInJava/static_impot_demo.java: -------------------------------------------------------------------------------- 1 | import static java.lang.System.*; 2 | 3 | class StaticImportDemo{ 4 | public static void main(String[] args){ 5 | out.println("Hello..."); 6 | } 7 | } -------------------------------------------------------------------------------- /Packeage in Java/9_2 serDefindPackagesInJava/UserDefinedPackageDemo.java: -------------------------------------------------------------------------------- 1 | package mypack; 2 | 3 | class UserDefinedPackageDemo{ 4 | public static void main(String [] args){ 5 | System.out.println("Hello from Package mypack..!"); 6 | } 7 | } -------------------------------------------------------------------------------- /Object and Classes/6_8 WrapperClass/wrapper_demo3.java: -------------------------------------------------------------------------------- 1 | class WrapperDemo3{ 2 | public static void main(String [] args){ 3 | Integer obj_i = 1001; 4 | String obj_s = obj_i.toString(); 5 | System.out.println("Object Has " + obj_s.length() + " Digits"); 6 | } 7 | } -------------------------------------------------------------------------------- /Operators/AssignmentOperators/src/SimpleAssignmentOperator.java: -------------------------------------------------------------------------------- 1 | public class SimpleAssignmentOperator { 2 | public static void main(String[] args) { 3 | // In there I am going to perform Simple assignment opeator 4 | int a = 10; 5 | int b = a; 6 | System.out.println(b); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Packeage in Java/9_2 serDefindPackagesInJava/UserDefinedPackageDemo3.java: -------------------------------------------------------------------------------- 1 | //import mypack.*; 2 | 3 | class UserDefinedPackageDemo3{ 4 | public static void main(String [] args){ 5 | mypack.UserDefinedPackageDemo2 obj = new mypack.UserDefinedPackageDemo2(10,20); 6 | System.out.println(obj); 7 | 8 | 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /Packeage in Java/mypack/UserDefinedPackageDemo2.java: -------------------------------------------------------------------------------- 1 | package mypack; 2 | 3 | public class UserDefinedPackageDemo2{ 4 | int i; 5 | int j; 6 | 7 | public UserDefinedPackageDemo2(int i, int j){ 8 | this.i = i; 9 | this.j = j; 10 | } 11 | 12 | public String toString(){ 13 | return "I: " + i + " J: " + j; 14 | } 15 | } -------------------------------------------------------------------------------- /Inheritance/7_7_3 ObjectClassAndMethods-Part III/get_class_demo.java: -------------------------------------------------------------------------------- 1 | class GetClassDemo{ 2 | public static void main(String [] args){ 3 | Object obj = new GetClassDemo(); 4 | String className = obj.getClass().getSuperclass().getName(); 5 | System.out.println(className); 6 | System.out.println(className.getClass().getName()); 7 | 8 | } 9 | } -------------------------------------------------------------------------------- /Operators/BitwiseOperators/src/BitwiseANDDemo.java: -------------------------------------------------------------------------------- 1 | //Bitwise AND (&) 2 | public class BitwiseANDDemo { 3 | public static void main(String[] args) { 4 | int a = 5; 5 | int b = 7; 6 | 7 | // bitwise and 8 | // 0101 & 0111=0101 = 5 9 | System.out.println("a&b = " + (a & b)); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Abstract and Interface/8_3 Interface/interface_demo2.java: -------------------------------------------------------------------------------- 1 | interface I{ 2 | static void f(){ 3 | System.out.println("F called"); 4 | } 5 | 6 | 7 | } 8 | 9 | class Demo implements I{ 10 | /*public void f(){ 11 | System.out.println("F called from Demo"); 12 | }*/ 13 | public static void main(String [] args){ 14 | I.f(); 15 | } 16 | } -------------------------------------------------------------------------------- /Object and Classes/6_8 WrapperClass/wrapper_demo2.java: -------------------------------------------------------------------------------- 1 | class WrapperDemo2{ 2 | public static void main(String [] args){ 3 | Integer obj_i = 5; 4 | Float obj_f = 5.78f; 5 | Character obj_c = 'R'; 6 | 7 | System.out.println(obj_i.intValue()); 8 | System.out.println(obj_f.floatValue()); 9 | System.out.println(obj_c.charValue()); 10 | } 11 | } -------------------------------------------------------------------------------- /Operators/UnaryOperator/src/UnaryMinus.java: -------------------------------------------------------------------------------- 1 | //Unary Minus: 2 | // It is use for change value from Positive to Negative: -(operand) 3 | public class UnaryMinus { 4 | public static void main(String[] args) { 5 | int a = 20; 6 | int b = -(a); 7 | System.out.println(" "+a); 8 | System.out.println(b); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Packeage in Java/9_1 PackagesInJava/builtin_package_demo.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | class BuiltInPackageDemo{ 4 | public static void main(String [] args){ 5 | System.out.println("Please Enter Your Name:"); 6 | Scanner sc = new Scanner(System.in); 7 | String my_name = sc.next(); 8 | System.out.println("Hello.. "+ my_name); 9 | 10 | 11 | } 12 | } -------------------------------------------------------------------------------- /Object and Classes/6_8 WrapperClass/wrapper_demo4.java: -------------------------------------------------------------------------------- 1 | import java.util.ArrayList; 2 | 3 | class WrappeDemo4{ 4 | public static void main(String [] args){ 5 | ArrayList myNumbers = new ArrayList(); 6 | myNumbers.add(10); 7 | myNumbers.add(20); 8 | myNumbers.add(30); 9 | myNumbers.add(40); 10 | 11 | for (int ele:myNumbers) 12 | System.out.println(ele); 13 | } 14 | } -------------------------------------------------------------------------------- /Object and Classes/6_8 WrapperClass/wrapper_demo1.java: -------------------------------------------------------------------------------- 1 | class WrapperDemo1{ 2 | public static void main(String [] args){ 3 | /*int i = 25; 4 | //Integer obj_i = Integer.valueOf(i); 5 | Integer obj_j = i; //autoboxing 6 | System.out.println(obj_j);*/ 7 | 8 | 9 | Integer obj_i = new Integer(27); 10 | //int i = obj_i.intValue(); 11 | int j = obj_i; 12 | System.out.println(j); 13 | } 14 | } -------------------------------------------------------------------------------- /Operators/ShiftOperators/src/UnsignedRightShift.java: -------------------------------------------------------------------------------- 1 | //3. Unsigned Right Shift Operator " >>> " 2 | // Syntax: 3 | // 4 | //left_operand >>> number 5 | public class UnsignedRightShift { 6 | public static void main(String[] args) { 7 | 8 | byte num1 = 8; 9 | byte num2 = -8; 10 | 11 | System.out.println(num1 >>> 2); 12 | System.out.println(num2 >>> 2); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Operators/AssignmentOperators/src/Main.java: -------------------------------------------------------------------------------- 1 | //Assignment Operator is use for assign the value in there left side operand 2 | // and right side value 3 | // These are two Types of Assignment Operator 4 | // 1. Simple Assignment Operator: " = " 5 | // 2. Compound Assignment Operator: "+=, -=, *=, /=" 6 | public class Main { 7 | public static void main(String[] args) { 8 | System.out.println("Hello world!"); 9 | } 10 | } -------------------------------------------------------------------------------- /Methods in Java/5_4 RecursiveMethods/recursive_demo.java: -------------------------------------------------------------------------------- 1 | class RecursiveDemo{ 2 | static int count = 0; 3 | public static void main(String [] args){ 4 | p_finite(); 5 | } 6 | 7 | /*static void p(){ 8 | System.out.println("Hello"); 9 | p();*/ 10 | 11 | static void p_finite(){ 12 | count ++; 13 | if (count <= 100){ 14 | System.out.println("Hello: " + count); 15 | p_finite(); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /Operators/UnaryOperator/src/NotOperator.java: -------------------------------------------------------------------------------- 1 | // Not Operator(!): 2 | // This Operator use to true to false and false to true with the help (!) 3 | public class NotOperator { 4 | public static void main(String[] args) { 5 | boolean a = true; 6 | boolean b = false; 7 | System.out.println(a); 8 | System.out.println(!a); 9 | System.out.println(b); 10 | System.out.println(!b); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Operators/BitwiseOperators/src/BitwiseORDemo.java: -------------------------------------------------------------------------------- 1 | // Bitwise OR (|) 2 | // a = 7 = 0111 (In Binary) 3 | // b = 7 = 0111 (In Binary) 4 | // 5 | // Bitwise OR Operation of 7 and 7 6 | // 0111 7 | // 0111 8 | // ________ 9 | // 0111 = 7(In decimal) 10 | public class BitwiseORDemo { 11 | public static void main(String[] args) { 12 | int a = 7; 13 | int b = 7; 14 | System.out.println("a|b = " + (a | b)); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Operators/BitwiseOperators/src/BitwiseXORDemo.java: -------------------------------------------------------------------------------- 1 | // Bitwise XOR (^) 2 | // a = 5 = 0101 (In Binary) 3 | // b = 7 = 0111 (In Binary) 4 | // 5 | //Bitwise XOR Operation of 5 and 7 6 | // 0101 7 | //^ 0111 8 | // ________ 9 | // 0010 = 2 (In decimal) 10 | public class BitwiseXORDemo { 11 | public static void main(String[] args) { 12 | int a = 5; 13 | int b = 7; 14 | System.out.println("a^b = " + (a ^ b)); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Operators/UnaryOperator/src/Main.java: -------------------------------------------------------------------------------- 1 | // This is Unary Operator Program 2 | // It need only one operand to perform any operation 3 | // like increment, decrement, negation, etc. 4 | // Types of Unary Operator 5 | // 1: Unary minus(-) 6 | // 2: ‘NOT’ Operator(!) 7 | // 3: Increment(++) 8 | // 4: Decrement(–) 9 | // 5: Bitwise Complement(~) 10 | public class Main { 11 | public static void main(String[] args) { 12 | System.out.println("Hello world!"); 13 | } 14 | } -------------------------------------------------------------------------------- /Operators/AssignmentOperators/src/CompoundAssignmentOperator.java: -------------------------------------------------------------------------------- 1 | public class CompoundAssignmentOperator { 2 | public static void main(String[] args) { 3 | int a = 10; 4 | System.out.println(a); 5 | a +=10; 6 | System.out.println(a); 7 | a -=10; 8 | System.out.println(a); 9 | a *=10; 10 | System.out.println(a); 11 | a /=10; 12 | System.out.println(a); 13 | 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Inheritance/7_7_3 ObjectClassAndMethods-Part III/finalize_demo.java: -------------------------------------------------------------------------------- 1 | class FinalizeDemo{ 2 | protected void finalize(){ 3 | System.out.println("Finalize Method is called"); 4 | } 5 | 6 | public FinalizeDemo(){ 7 | System.out.println("FinalizeDemo is Created"); 8 | } 9 | 10 | public static void main(String [] args){ 11 | FinalizeDemo obj = new FinalizeDemo(); 12 | 13 | obj = null; 14 | System.gc(); 15 | System.out.println("Main Exiting"); 16 | } 17 | } -------------------------------------------------------------------------------- /Operators/ShiftOperators/src/Main.java: -------------------------------------------------------------------------------- 1 | // Shift Operator 2 | // By shifting the bits of its first operand right or left, 3 | // a shift operator performs bit manipulation on data. 4 | // These are the Shift Operators 5 | // 1. Signed Left Shift Operator " << " 6 | // 2. Signed Right Shift Operator " >> " 7 | // 3. Unsigned Right Shift Operator " >>> " 8 | public class Main { 9 | public static void main(String[] args) { 10 | System.out.println("Hello world!"); 11 | } 12 | } -------------------------------------------------------------------------------- /Operators/Operators.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Operators/ShiftOperators/ShiftOperators.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Operators/UnaryOperator/UnaryOperator.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Fundamentals Of Java/Fundamentals Of Java.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Operators/BitwiseOperators/BitwiseOperators.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Operators/Logicaloperators/Logicaloperators.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Operators/TernaryOperator/TernaryOperator.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Methods in Java/5_4 RecursiveMethods/factorial_demo.java: -------------------------------------------------------------------------------- 1 | class FactorialDemo{ 2 | public static void main(String [] args){ 3 | System.out.println("The value is : " + factorial(5)); 4 | } 5 | 6 | public static int factorial(int val){ 7 | int ans = 1; 8 | for (int i = 1;i<=val ; i++) 9 | ans *= i; 10 | return ans; 11 | } 12 | 13 | 14 | 15 | /*public static int factorial(int val){ 16 | if (val ==1) 17 | return 1; 18 | else 19 | return val * factorial(val-1); 20 | }*/ 21 | } -------------------------------------------------------------------------------- /Operators/AssignmentOperators/AssignmentOperators.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Operators/RelationalOperator/RelationalOperator.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Operators/ArithmeticsOperators/ArithmeticsOperators.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Operators/Logicaloperators/ShiftOperator/ShiftOperator.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Exception Handling/10_2_1 KeywordsExceptionHanlding/ExceptionHandlingDemo1.java: -------------------------------------------------------------------------------- 1 | class ExceptionHandlingDemo1{ 2 | public static void main(String [] args){ 3 | int a = 10, b; 4 | try{ 5 | b = Integer.parseInt(args[0]); 6 | int ans = a/b; 7 | System.out.println("The ans is :" + ans); 8 | } 9 | catch(Exception e){ 10 | System.out.println("Exception is Generated:" + e); 11 | } 12 | finally{ 13 | System.out.println("Always Gets Executed"); 14 | } 15 | System.out.println("After Try block"); 16 | } 17 | } -------------------------------------------------------------------------------- /Methods in Java/5_3 MethodOverloading/promotion_demo.java: -------------------------------------------------------------------------------- 1 | class PromoteDemo{ 2 | public static void main(String [] args){ 3 | int i_val = 10; 4 | float f_val = 4.3f; 5 | //double d_val = 5.6; 6 | myprint(i_val); 7 | myprint(f_val); 8 | } 9 | 10 | static void myprint(float val){ 11 | System.out.println("Float Parameter Method Called"); 12 | System.out.println(val); 13 | } 14 | /*static void myprint(int val){ 15 | System.out.println("Int Parameter Method Called"); 16 | System.out.println(val); 17 | }*/ 18 | } -------------------------------------------------------------------------------- /Exception Handling/10_4 Hierarchy of Exceptions/ExceptionMethodsDemo.java: -------------------------------------------------------------------------------- 1 | class ExceptionMethodsDemo{ 2 | public static void main(String [] args){ 3 | try{ 4 | int a = Integer.parseInt(args[0]); 5 | int b = Integer.parseInt(args[1]); 6 | int ans = a/b; 7 | System.out.println("The Answer is" + ans); 8 | } 9 | catch (Exception e){ 10 | System.out.println(e.getMessage()); 11 | //System.out.println(e.getStackTrace()); 12 | //e.printStackTrace(); 13 | System.out.println(e.getCause()); 14 | 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Operators/UnaryOperator/src/BitwiseComplement.java: -------------------------------------------------------------------------------- 1 | //This unary operator returns the one’s complement representation of 2 | // the input value or operand, i.e, with all bits inverted, 3 | // which means it makes every 0 to 1, and every 1 to 0. 4 | // ~(operand) 5 | public class BitwiseComplement { 6 | public static void main(String[] args) { 7 | int num1 = 6; int num2 = 2; 8 | System.out.println(num1 + "'s bitwise complement = " + ~num1); 9 | System.out.println(num2 + "'s bitwise complement = " + ~num2); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Exception Handling/10_2_2 KeywordsExceptionHanlding/ExceptionHandlingDemo2.java: -------------------------------------------------------------------------------- 1 | class ExceptionHandlingDemo2{ 2 | public static void main(String [] args){ 3 | int a, b; 4 | try{ 5 | a = Integer.parseInt(args[0]); 6 | b = Integer.parseInt(args[1]); 7 | if ((b <= 0) || (a <=0)) 8 | throw new ArithmeticException(); 9 | int ans = a/b; 10 | System.out.println("The answe is :" + ans); 11 | } 12 | catch(ArithmeticException e){ 13 | System.out.println("Sorry we want both numbers to be Non-Zero Positive"); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Operators/ShiftOperators/src/SighnedLeftShift.java: -------------------------------------------------------------------------------- 1 | //1. Signed Left Shift Operator in Java 2 | //This operator is represented by a symbol <<, read as double less than. 3 | // 4 | //Syntax: 5 | // 6 | //left_operand << number 7 | public class SighnedLeftShift { 8 | public static void main(String[] args) { 9 | byte a = 64, b; 10 | int i; 11 | 12 | i = a << 2; 13 | b = (byte)(a << 2); 14 | System.out.println("Original value of a: " + a); 15 | System.out.println("i and b: " + i + " " + b); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Abstract and Interface/8_5 ComparingAbstractClassAndInterface/abstract_interface_demo.java: -------------------------------------------------------------------------------- 1 | class Base{} 2 | 3 | abstract class AbDemo{ 4 | int var1; 5 | final int var2 = 10; 6 | void f(){ 7 | var1++; 8 | System.out.println("F from AbDemo"); 9 | } 10 | 11 | abstract void g(); 12 | } 13 | 14 | interface I1{ 15 | int var3 = 4; 16 | final int var4 = 5; 17 | default void h(){ 18 | System.out.println("H From I"); 19 | var3++; 20 | } 21 | 22 | //abstract void j(); 23 | } 24 | 25 | interface I2{} 26 | 27 | class Dervied extends Base implements I1{} -------------------------------------------------------------------------------- /Inheritance/7_3 superKeyword/super_demo.java: -------------------------------------------------------------------------------- 1 | class SuperDemo{ 2 | public static void main(String [] args){ 3 | Derived obj = new Derived(); 4 | obj.printIJ(); 5 | } 6 | } 7 | 8 | class Base{ 9 | private int i; 10 | Base(){ 11 | i = 10; 12 | } 13 | public void printI(){ 14 | System.out.println(i); 15 | } 16 | } 17 | 18 | class Derived extends Base{ 19 | private int j; 20 | Derived(){ 21 | super.i = 20; 22 | //super(); 23 | this.j = 30; 24 | } 25 | public void printIJ(){ 26 | super.printI(); 27 | System.out.println(j); 28 | } 29 | } -------------------------------------------------------------------------------- /Operators/UnaryOperator/src/Decrement.java: -------------------------------------------------------------------------------- 1 | //Decrement(–) 2 | // It is used to decrement the value of an integer. 3 | // It Also Implement in two ways: 4 | // 1. Post-decrement operator 5 | // 2. Pre-decrement operator 6 | public class Decrement { 7 | public static void main(String[] args) { 8 | int a = 9; 9 | System.out.println(a); // OutPut = 9 10 | a--; 11 | System.out.println(a); // OutPut = 8 12 | --a; 13 | System.out.println(a); // OutPut = 7 14 | System.out.println(a--); // OutPut = 7 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Exception Handling/10_3 try catch finally InDetail/checkedException.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | class CheckedExceptionExample { 3 | public static void main(String args[]) { 4 | FileInputStream file_data = null; 5 | try{ 6 | file_data = new FileInputStream("D:/temp/dummy.txt"); 7 | int m; 8 | while(( m = file_data.read() ) != -1) { 9 | System.out.print((char)m); 10 | } 11 | file_data.close(); 12 | } 13 | catch (FileNotFoundException fnf){} 14 | catch (IOException ioe){} 15 | 16 | } 17 | } -------------------------------------------------------------------------------- /Operators/BitwiseOperators/src/Main.java: -------------------------------------------------------------------------------- 1 | //Bitwise Operators 2 | // It ia used to performing the manipulation of individual bits of a number. 3 | // They can be used with any integral type (char, short, int, etc.). 4 | // They are used when performing update and query operations of the Binary indexed trees. 5 | // These are Bitwise Operator 6 | // 1. Bitwise OR (|) 7 | // 2. Bitwise AND (&) 8 | // 3. Bitwise XOR (^) 9 | // 4. Bitwise Complement (~) 10 | // 11 | public class Main { 12 | public static void main(String[] args) { 13 | System.out.println("Hello world!"); 14 | } 15 | } -------------------------------------------------------------------------------- /Abstract and Interface/8_2 AbstractAndFinal/absract_final_demo1.java: -------------------------------------------------------------------------------- 1 | abstract class FinalClass{ 2 | public FinalClass(){ 3 | System.out.println("FinalClass Instantiated"); 4 | } 5 | abstract final public void f(){ 6 | System.out.println("F() Called..."); 7 | } 8 | } 9 | 10 | class DerviedFinalClass extends FinalClass{ 11 | final public void f(){ 12 | System.out.println("F() of Devired Called..."); 13 | } 14 | } 15 | 16 | 17 | class AbstractFinalDemo{ 18 | public static void main(String [] args){ 19 | //FinalClass obj = new FinalClass(); 20 | //obj.f(); 21 | } 22 | } -------------------------------------------------------------------------------- /Operators/src/Main.java: -------------------------------------------------------------------------------- 1 | // Operator is nothing but which help to perform any kind of operation 2 | // Types op Operator 3 | // 1-Arithmetics Operator("+, _, *, %, /") 4 | // 2-Relational Operator("<,>,<=,>=,==") 5 | // 3-Bitwise Operator(>>,<<,<<<) 6 | // 4-Conditional Operator( 7 | // 5-Logical Operator("&&, ||,!=, ") 8 | // 6-Assignment Operator (" = ") 9 | // 7-Unary Operators 10 | // 8-Ternary Operators 11 | // 9-Instance Operator 12 | public class Main { 13 | public static void main(String[] args) { 14 | System.out.println("This is Operator Section Go to ArithmeticsOperatorDemo.java File"); 15 | } 16 | } -------------------------------------------------------------------------------- /Exception Handling/10_2_2 KeywordsExceptionHanlding/ExceptionHandlingDemo3.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | class ExceptionHandlingDemo3{ 3 | void m1(int a) throws IOException{ 4 | if (a <0) 5 | throw new IOException(); 6 | System.out.println("Valid Value a:" +a); 7 | } 8 | 9 | void m2(int a) throws IOException{ 10 | 11 | m1(a); 12 | 13 | 14 | } 15 | public static void main(String args[]){ 16 | ExceptionHandlingDemo3 obj = new ExceptionHandlingDemo3(); 17 | int val = Integer.parseInt(args[0]); 18 | try{ 19 | obj.m2(val); 20 | } 21 | catch(Exception e) {} 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Inheritance/7_5 MethodOverridingInJava/method_ovreriding_demo1.java: -------------------------------------------------------------------------------- 1 | class Base{ 2 | public Base(){ 3 | System.out.println("Base Created"); 4 | } 5 | protected void print(){ 6 | System.out.println("Hello From Base"); 7 | } 8 | } 9 | 10 | class Derived extends Base{ 11 | public Derived(){ 12 | System.out.println("Derived Created"); 13 | } 14 | protected void print(){ 15 | System.out.println("Hello From Derived"); 16 | } 17 | } 18 | 19 | class MethodOverridingDemo1{ 20 | public static void main(String [] args){ 21 | Base b = new Derived(); 22 | 23 | b.print(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /Inheritance/7_6 finalKeywordInJava/final_demo1.java: -------------------------------------------------------------------------------- 1 | class FinalDemo1{ 2 | public static void main(String args[]){ 3 | Derived d1 = new Derived(); 4 | 5 | d1.print(); 6 | 7 | } 8 | } 9 | 10 | class Base{ 11 | Base(){ 12 | System.out.println("Base Created"); 13 | } 14 | 15 | final public void print(){ 16 | System.out.println("Hello From Base"); 17 | } 18 | 19 | } 20 | 21 | class Derived extends Base{ 22 | Derived (){ 23 | System.out.println("Derived Created"); 24 | } 25 | /*public void print(){ 26 | System.out.println("Hello From Derived"); 27 | }*/ 28 | 29 | } -------------------------------------------------------------------------------- /Inheritance/7_4_2 constrcutorInInheritance Part 2/constructor_call_demo2.java: -------------------------------------------------------------------------------- 1 | class ConstructorCallDemo2{ 2 | public static void main(String [] args){ 3 | C cObj = new C(10); 4 | } 5 | } 6 | 7 | 8 | class A{ 9 | public A(int i){ 10 | i = 10; 11 | System.out.println("A Constructor Called"); 12 | } 13 | } 14 | 15 | class B extends A{ 16 | public B(int j){ 17 | j = 10; 18 | super(10); 19 | System.out.println("B Constructor Called"); 20 | } 21 | } 22 | 23 | class C extends B{ 24 | public C(int k){ 25 | super(10); 26 | k = 10; 27 | System.out.println("C Constructor Called"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Operators/RelationalOperator/src/Main.java: -------------------------------------------------------------------------------- 1 | // Relational Operaor is Show the Relation between the Variables 2 | // The are The Relational Operators 3 | // "<" : This is Less Than Operator 4 | // ">" : This is Greater Than Operator 5 | // "<=" : This is Less Than Equal TO Operator 6 | // ">=" : This is Greater Than Equal To Operator 7 | // "==" : This is Comperision Operator which is use for compare the two element 8 | // "!=" : This is Not Equal to Operator 9 | public class Main { 10 | public static void main(String[] args) { 11 | System.out.println("For Example And Better Understanding Please Check all the folder!"); 12 | } 13 | } -------------------------------------------------------------------------------- /Operators/BitwiseOperators/src/BitwiseComplementDemo.java: -------------------------------------------------------------------------------- 1 | // Bitwise Complement (~) 2 | // a = 5 = 0101 (In Binary) 3 | // 4 | //Bitwise Complement Operation of 5 5 | // 6 | //~ 0101 7 | // ________ 8 | // 1010 = 10 (In decimal) 9 | public class BitwiseComplementDemo { 10 | public static void main(String[] args) { 11 | int a = 5; 12 | int b = 7; 13 | System.out.println("~a = " + ~a); 14 | 15 | // can also be combined with 16 | // assignment operator to provide shorthand 17 | // assignment 18 | // a=a&b 19 | a &= b; 20 | System.out.println("a= " + a); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Inheritance/7_7_1 ObjectClassAndMethods-Part I/to_string_demo.java: -------------------------------------------------------------------------------- 1 | class Rectangle{ 2 | int length; 3 | int width; 4 | 5 | public void set(int l, int w){ 6 | length = l; 7 | width = w; 8 | } 9 | 10 | /*public void print(){ 11 | System.out.println("Length: " + length); 12 | System.out.println("Width: " + width); 13 | 14 | */ 15 | 16 | public String toString(){ 17 | String msg; 18 | msg = "Length: " + length + " Width: " + width; 19 | return msg; 20 | } 21 | 22 | public static void main(String [] args){ 23 | Rectangle r = new Rectangle(); 24 | r.set(10,20); 25 | 26 | System.out.println(r); 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /Operators/UnaryOperator/src/IncrementOperator.java: -------------------------------------------------------------------------------- 1 | // Increment(++) 2 | // It is used to increment the value of an integer. 3 | // There is two ways for implement 4 | // 1. Pre-increment operator 5 | // 2. Post-increment operator 6 | public class IncrementOperator { 7 | public static void main(String[] args) { 8 | int num = 5; 9 | System.out.println(num); // OutPut 5 10 | num++; // Post Increment 11 | System.out.println(num); // OutPut 5+1 = 6 12 | ++num; // Pre- Increment 13 | System.out.println(num); // OutPut 1+6 = 7 14 | System.out.println(++num);// OutPut 1+7 = 8 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Fundamentals Of Java/src/TypeCastingExample.java: -------------------------------------------------------------------------------- 1 | public class TypeCastingExample { 2 | public static void main(String[] args) { 3 | // There are two Type of Type Casting 1. Implicit 2. Explicit 4 | 5 | 6 | // Implicit TypeCasting int to long 7 | int num = 200; 8 | long num1 = num; 9 | System.out.println(num); 10 | System.out.println(num1); 11 | System.out.println(); 12 | 13 | 14 | //Explicit TypeCastiong from Double to Interger 15 | 16 | double price = 100.00; 17 | int price1 = (int) price; 18 | System.out.println(price); 19 | System.out.println(price1); 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Methods in Java/5_2 DemonstratingMethods/func_prime_check.java: -------------------------------------------------------------------------------- 1 | class FPrimeCheck{ 2 | public static boolean isPrime(int n){ 3 | boolean flag = true; 4 | for (int i=2;i<(int)n/2;i++) 5 | if (n % i == 0){ 6 | flag = false; 7 | break; 8 | } 9 | return flag; 10 | } 11 | 12 | 13 | public static void main(String [] args){ 14 | int num = 121; 15 | if (isPrime(num)) 16 | System.out.println(num + " is Prime"); 17 | else 18 | System.out.println(num + " is Not Prime"); 19 | 20 | int num2 = 456; 21 | if (isPrime(num2)) 22 | System.out.println(num2 + " is Prime"); 23 | else 24 | System.out.println(num2 + " is Not Prime"); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Object and Classes/6_5 thisKeyword/this_demo.java: -------------------------------------------------------------------------------- 1 | class ThisDemo{ 2 | public static void main(String []args){ 3 | Demo d = new Demo(20); 4 | Demo d1 = new Demo(33); 5 | Demo maxD; 6 | maxD = d.greater(d1); 7 | maxD.print(); 8 | } 9 | } 10 | 11 | class Demo{ 12 | int i; 13 | 14 | Demo(int i) 15 | { 16 | this.i = i; 17 | } 18 | 19 | Demo greater(Demo d){ 20 | if (d.i > this.i) 21 | return d; 22 | else 23 | return this; 24 | } 25 | /*Demo(int j,int k, int l){ 26 | /*this.i = 100; 27 | this.j = j; 28 | this.k = k; 29 | this.l = l; 30 | 31 | this(100,j,k,l); 32 | }*/ 33 | void print(){ 34 | System.out.println(this.i); 35 | } 36 | } -------------------------------------------------------------------------------- /Inheritance/7_7_1 ObjectClassAndMethods-Part I/hash_code_demo.java: -------------------------------------------------------------------------------- 1 | class Student{ 2 | int rollNo; 3 | String name; 4 | 5 | public Student(int rollNo, String name){ 6 | this.rollNo = rollNo; 7 | this.name = name; 8 | } 9 | 10 | public String toString(){ 11 | return "RollNo: " + rollNo + " Name: " + name; 12 | } 13 | 14 | public int hashCode(){ 15 | return rollNo; 16 | } 17 | 18 | public static void main(String [] args){ 19 | Student s1 = new Student(101,"Stuti"); 20 | System.out.println(s1); 21 | //String hash_s1 = String.valueOf(s1.hashCode()); 22 | //System.out.println(Integer.toHexString(s1.hashCode())); 23 | System.out.println(s1.hashCode()); 24 | } 25 | } -------------------------------------------------------------------------------- /Object and Classes/6_7 InitializerBlocks/initializer_block_demo.java: -------------------------------------------------------------------------------- 1 | class InitializerBlockDemo{ 2 | private int i=0; 3 | public InitializerBlockDemo(){ 4 | i++; 5 | System.out.println("Inside Constructor: "+i); 6 | } 7 | 8 | { 9 | i++; 10 | System.out.println("Initializer Block 1: "+i); 11 | } 12 | 13 | { 14 | i++; 15 | System.out.println("Initializer Block 2: " + i); 16 | } 17 | 18 | public static void main(String [] args){ 19 | System.out.println("Main Started"); 20 | InitializerBlockDemo obj1 = new InitializerBlockDemo(); 21 | System.out.println("Main Mid Way"); 22 | InitializerBlockDemo obj2 = new InitializerBlockDemo(); 23 | System.out.println("Main End"); 24 | } 25 | } -------------------------------------------------------------------------------- /Operators/ShiftOperators/src/ShinedRightShift.java: -------------------------------------------------------------------------------- 1 | // 2. Signed Right Shift Operator " >> " 2 | // 3 | // Syntax: 4 | // 5 | //left_operand >> number 6 | public class ShinedRightShift { 7 | public static void main(String[] args) { 8 | int number = 8; 9 | 10 | // 2 bit signed right shift 11 | int Ans = number >> 2; 12 | 13 | System.out.println(Ans); 14 | char hex[]={ 15 | '0','1','2','3','4','5', 16 | '6','7','8','9','a','b','c', 17 | 'd','e','f' 18 | }; 19 | 20 | byte b=(byte) 0xf1; 21 | 22 | System.out.println("b = 0x" + hex [(b>>4) & 0x0f] + hex[b & 0x0f]); 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Abstract and Interface/8_2 AbstractAndFinal/absract_final_demo2.java: -------------------------------------------------------------------------------- 1 | final class Base{ 2 | abstract public void f(); 3 | final public void g(){ 4 | System.out.println("G Called..."); 5 | } 6 | 7 | public void h(){ 8 | System.out.println("H From Base is Called..."); 9 | } 10 | } 11 | 12 | /*class Derived extends Base{ 13 | public void f(){ 14 | System.out.println("F Called.."); 15 | } 16 | 17 | public void h(){ 18 | System.out.println("H from Derived Called.."); 19 | } 20 | }*/ 21 | 22 | class AbstractFinalDemo{ 23 | public static void main(String [] args){ 24 | /*Derived obj = new Derived(); 25 | obj.f(); 26 | obj.g(); 27 | obj.h();*/ 28 | } 29 | } 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Abstract and Interface/8_5 ComparingAbstractClassAndInterface/abstract_interface_demo_2.java: -------------------------------------------------------------------------------- 1 | interface I1{ 2 | void f(); 3 | 4 | } 5 | 6 | abstract class AbBase{ 7 | abstract void h(); 8 | public AbBase(){ 9 | System.out.println("AbBase Created"); 10 | } 11 | } 12 | 13 | class Derived extends AbBase implements I1{ 14 | public void f(){ 15 | System.out.println("F called"); 16 | } 17 | 18 | void h(){ 19 | System.out.println("H called"); 20 | } 21 | 22 | public static void main(String[] args){ 23 | I1 obj1 = new Derived(); 24 | AbBase obj2 = new Derived(); 25 | Derived obj3 = new Derived(); 26 | ((I1)obj2).f(); 27 | obj2.h(); 28 | obj3.f(); 29 | obj3.h(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Methods in Java/5_2 DemonstratingMethods/func_call_demo.java: -------------------------------------------------------------------------------- 1 | class FunctionCallDemo{ 2 | public static void f(){ 3 | System.out.println("Inside F...Before Calling g()"); 4 | g(); 5 | System.out.println("Inside F...After Calling g()"); 6 | } 7 | 8 | public static void g(){ 9 | System.out.println("Inside G...Before Calling h()"); 10 | h(); 11 | System.out.println("Inside G...After Calling h()"); 12 | } 13 | 14 | public static void h(){ 15 | System.out.println("Inside H..."); 16 | } 17 | 18 | public static void main(String [] args){ 19 | System.out.println("Inside Main...Before Calling f()"); 20 | f(); 21 | System.out.println("Inside Main...After Calling f()"); 22 | } 23 | } 24 | 25 | 26 | -------------------------------------------------------------------------------- /Operators/TernaryOperator/src/TernaryOperator.java: -------------------------------------------------------------------------------- 1 | // Ternary Operator 2 | // This is the only conditional operator that takes three operands. 3 | // It’s a one-liner replacement for the if-then-else statement and is used 4 | // a lot in Java programming. 5 | 6 | // This is Operator use in place of If- Else and also Place of Switch 7 | 8 | public class TernaryOperator { 9 | public static void main(String[] args) { 10 | 11 | int num1 = 15, num2 = 10, result; 12 | 13 | System.out.println("First num: " + num1); 14 | System.out.println("Second num: " + num2); 15 | 16 | 17 | result = (num1 > num2) ? (num1 + num2) : (num1 - num2); 18 | 19 | 20 | System.out.println("Result = " + result); 21 | 22 | } 23 | } -------------------------------------------------------------------------------- /Abstract and Interface/8_3 Interface/interface_demo1.java: -------------------------------------------------------------------------------- 1 | interface I1{ 2 | int no = 10; 3 | void f(); 4 | } 5 | 6 | interface I2{ 7 | int no2 = 20; 8 | void g(); 9 | } 10 | 11 | interface I3 extends I1,I2{ 12 | } 13 | 14 | 15 | class Base{ 16 | //int no3; 17 | void h(){ 18 | System.out.println("H Called..."); 19 | } 20 | } 21 | 22 | 23 | class Demo extends Base implements I3{ 24 | public void f(){ 25 | //no = no + 1; 26 | System.out.println("F called..:" + no); 27 | } 28 | 29 | public void g(){ 30 | //no = no + 1; 31 | System.out.println("G called..:" + no2); 32 | } 33 | 34 | 35 | public static void main(String [] args){ 36 | Demo obj = new Demo(); 37 | obj.f(); 38 | obj.g(); 39 | obj.h(); 40 | } 41 | } -------------------------------------------------------------------------------- /Exception Handling/10_4 Hierarchy of Exceptions/GetCauseMethodDemo.java: -------------------------------------------------------------------------------- 1 | class GetCauseMethodDemo{ 2 | public static void main(String args[]) throws Exception{ 3 | try{ 4 | m1(); 5 | } 6 | catch(Exception e){ 7 | System.out.println("Cause:" + e.getCause()); 8 | } 9 | } 10 | 11 | public static void m1() throws Exception{ 12 | int arr [] = {1,2,3,4,5}; 13 | 14 | try{ 15 | if (condition1) 16 | arr[10] = 43; 17 | if (condition2) 18 | arr[0]/0; 19 | } 20 | catch (ArrayIndexOutOfBoundsException ae){ 21 | Exception e = new Exception(); 22 | e.initCause(ae); 23 | throw(e); 24 | } 25 | catch(ArithmeticException ae){ 26 | Exception e = new Exception(); 27 | e.initCause(ae); 28 | throw(e); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Object and Classes/6_4 ConstructorsInJava/constructor_demo.java: -------------------------------------------------------------------------------- 1 | class ConstructorDemo{ 2 | public static void main(String [] args){ 3 | Student s = new Student(101,45.5f); 4 | Student s2 = new Student(102); 5 | Student s1 = new Student(); 6 | s.displayStudent(); 7 | s1.displayStudent(); 8 | s2.displayStudent(); 9 | 10 | 11 | } 12 | } 13 | 14 | class Student{ 15 | private int rollNo; 16 | private float marks; 17 | 18 | public Student(){ 19 | rollNo = 1; 20 | marks = 50f; 21 | } 22 | 23 | public Student(int r){ 24 | rollNo = r; 25 | marks = 50f; 26 | } 27 | 28 | public Student(int r, float m){ 29 | rollNo = r; 30 | marks = m; 31 | } 32 | public void displayStudent(){ 33 | System.out.println("RollNo:" + rollNo + " Marks: " + marks); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Exception Handling/10_1 BasicsExceptionHandling/BasicsExceptionHandlingDemo.java: -------------------------------------------------------------------------------- 1 | class Demo{ 2 | int a[] = new int[5]; 3 | 4 | public void set(){ 5 | for (int i = 0;i<5;i++) 6 | a[i] = i+2; 7 | } 8 | 9 | public void print(){ 10 | for (int i = 0;i<=15;i++) 11 | System.out.println(a[i]); 12 | } 13 | 14 | public static void main(String [] args){ 15 | 16 | //obj.a[0] = 20; 17 | //System.out.println("Setting of a[0] done"); 18 | //obj.a[25] = 20; 19 | //System.out.println("Setting of a[25] done"); 20 | //try{ 21 | //obj.print(); 22 | int b = 10; 23 | c = sc.nextInt(); 24 | int a = b/c; 25 | //} 26 | //catch(Exception e){ 27 | // } 28 | System.out.println("After Calling Print Method"); 29 | int x = 10; 30 | System.out.println("X =" + x); 31 | 32 | } 33 | } -------------------------------------------------------------------------------- /Exception Handling/10_5 TypesOfException/TypesOfExceptionDemo.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | class TypesOfExceptionDemo{ 3 | public static void main(String [] args) throws Exception{ 4 | int a = Integer.parseInt(args[0]); 5 | int b = Integer.parseInt(args[1]); 6 | if ((a==0) || (b==0)) 7 | throw new Exception(); 8 | System.out.println("Ans is: " + (a/b)); 9 | /*try{ 10 | FileInputStream f = null; 11 | f = new FileInputStream("D:\temp\dummy.txt"); 12 | int m; 13 | while ((m = f.read()) != -1) { 14 | System.out.println((char) m); 15 | } 16 | f.close(); 17 | } 18 | catch(FileNotFoundException fnf){ 19 | System.out.println("Please check...File is not there"); 20 | } 21 | catch(IOException ioe){ 22 | System.out.println("Could not perform operation on file"); 23 | }*/ 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /Inheritance/7_7_2 ObjectClassAndMethods-Part II/clone_demo.java: -------------------------------------------------------------------------------- 1 | class Rectangle implements Cloneable{ 2 | int length; 3 | int width; 4 | 5 | public Rectangle(int length, int width){ 6 | this.length = length; 7 | this.width = width; 8 | } 9 | 10 | public String toString(){ 11 | return "Length: " + length + " Width: " + width; 12 | } 13 | 14 | public static void main(String [] args){ 15 | Rectangle r1 = new Rectangle(10,20); 16 | try{ 17 | Rectangle r2 = (Rectangle) r1.clone(); 18 | System.out.println(r1); 19 | System.out.println(r2); 20 | 21 | r2.length = 35; 22 | System.out.println("After Modifying R2 - length"); 23 | 24 | System.out.println(r1); 25 | System.out.println(r2); 26 | } 27 | catch(CloneNotSupportedException ce){ 28 | System.out.println(ce); 29 | } 30 | 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /Object and Classes/6_7 InitializerBlocks/static_initializer_block_demo.java: -------------------------------------------------------------------------------- 1 | class StaticInitializerBlockDemo{ 2 | private int i=0; 3 | private static int j = 1; 4 | public static void main(String [] args){ 5 | System.out.println("Main Started"); 6 | StaticInitializerBlockDemo obj1 = new StaticInitializerBlockDemo(); 7 | System.out.println("Main End"); 8 | } 9 | 10 | { 11 | i++; 12 | System.out.println("Initializer Block - 1: "+ j); 13 | } 14 | { 15 | i++; 16 | System.out.println("Initializer Block - 2:" + i); 17 | } 18 | 19 | public StaticInitializerBlockDemo(){ 20 | i++; 21 | System.out.println("Inside Constructor: "+ i); 22 | } 23 | 24 | static{ 25 | j++; 26 | System.out.println("Static Initializer Block - 1: " + j); 27 | } 28 | 29 | static { 30 | System.out.println("Static Initializer Block - 2"); 31 | } 32 | } -------------------------------------------------------------------------------- /Object and Classes/6_2 AccessModifiersInJava/access_modifier_demo.java: -------------------------------------------------------------------------------- 1 | class AccessModifierDemo{ 2 | public static void main(String [] args){ 3 | Student s = new Student(); 4 | s.setRollNo(176); 5 | //s.rollNo = 101; 6 | s.setName("Ritesh"); 7 | 8 | System.out.println("RollNo:" + s.getRollNo()); 9 | System.out.println("Name:" + s.getName()); 10 | } 11 | } 12 | 13 | 14 | class Student{ 15 | private int rollNo; 16 | private String name; 17 | 18 | public void setRollNo(int r){ 19 | if ((r >= 101) && (r <=170)) 20 | rollNo = r; 21 | else{ 22 | rollNo = 0; 23 | System.out.println("Roll Number is not within the Range"); 24 | } 25 | } 26 | 27 | public int getRollNo(){ 28 | return rollNo; 29 | } 30 | 31 | public void setName(String nm){ 32 | name = nm; 33 | } 34 | 35 | public String getName(){ 36 | return name; 37 | } 38 | } -------------------------------------------------------------------------------- /Fundamentals Of Java/src/ReadingInputFromUser.java: -------------------------------------------------------------------------------- 1 | import java.util.* 2 | ;public class ReadingInputFromUser { 3 | public static void main(String[] args) { 4 | Scanner in = new Scanner(System.in); 5 | System.out.println("Enter Your Name : "); 6 | String name = in.nextLine(); 7 | System.out.println("Enter Your Age : "); 8 | int age = in.nextInt(); 9 | System.out.println("Enter Your Gender (M/F) :"); 10 | char gender = in.next().charAt(0); 11 | System.out.println("Enter Your Contact Number : "); 12 | double contact = in.nextDouble(); 13 | System.out.println(); 14 | System.out.println("User Details : "); 15 | System.out.println("Name : "+name); 16 | System.out.println("Age : "+age); 17 | System.out.println("Contact Number : "+ contact); 18 | System.out.println("Gender : "+gender); 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Inheritance/7_4_1 constrcutorInInheritance Part 1/constructor_call_demo.java: -------------------------------------------------------------------------------- 1 | 2 | class ConstructorCallDemo1 { 3 | public static void main(String [] args){ 4 | Derived dObj = new Derived(10,20); 5 | 6 | dObj.printIJ(); 7 | } 8 | } 9 | 10 | 11 | 12 | class Base{ 13 | protected int i; 14 | public Base(){ 15 | System.out.println("Base Default Constructor Called"); 16 | 17 | i = 15; 18 | } 19 | public Base(int i){ 20 | System.out.println("Base Parameterized Constructor Called"); 21 | this.i = i; 22 | } 23 | public void printI(){ 24 | System.out.println(i); 25 | } 26 | } 27 | 28 | class Derived extends Base{ 29 | int j; 30 | 31 | public Derived(int i, int j){ 32 | super(i); 33 | System.out.println("Derived Constructor Called"); 34 | this.j = j; 35 | } 36 | 37 | public void printIJ(){ 38 | System.out.println("I:" + i); 39 | System.out.println("J:" + j); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Inheritance/7_4_2 constrcutorInInheritance Part 2/constructor_call_demo.java: -------------------------------------------------------------------------------- 1 | 2 | class ConstructorCallDemo1 { 3 | public static void main(String [] args){ 4 | Derived dObj = new Derived(10,20); 5 | 6 | dObj.printIJ(); 7 | } 8 | } 9 | 10 | 11 | 12 | class Base{ 13 | protected int i; 14 | public Base(){ 15 | System.out.println("Base Default Constructor Called"); 16 | 17 | i = 15; 18 | } 19 | public Base(int i){ 20 | System.out.println("Base Parameterized Constructor Called"); 21 | this.i = i; 22 | } 23 | public void printI(){ 24 | System.out.println(i); 25 | } 26 | } 27 | 28 | class Derived extends Base{ 29 | int j; 30 | 31 | public Derived(int i, int j){ 32 | super(i); 33 | System.out.println("Derived Constructor Called"); 34 | this.j = j; 35 | } 36 | 37 | public void printIJ(){ 38 | System.out.println("I:" + i); 39 | System.out.println("J:" + j); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Object and Classes/6_6 staticsKeyword/static_demo.java: -------------------------------------------------------------------------------- 1 | class Student{ 2 | int rollNo; 3 | static int passingMarks; 4 | float marks; 5 | 6 | public static void setPassingMarks(int pm){ 7 | passingMarks = pm; 8 | 9 | } 10 | 11 | public void set(int rollNo, float marks){ 12 | this.rollNo = rollNo; 13 | this.marks = marks; 14 | 15 | } 16 | 17 | public void display(){ 18 | System.out.println("RollNo: " + rollNo); 19 | System.out.println("marks: " + marks); 20 | if (marks < passingMarks) 21 | System.out.println("Grade : Fail"); 22 | else 23 | System.out.println("Grade : Pass"); 24 | } 25 | } 26 | class StaticDemo{ 27 | 28 | public static void main(String [] args){ 29 | Student.setPassingMarks(40); 30 | 31 | Student s1 = new Student(); 32 | Student s2 = new Student(); 33 | 34 | s1.set(101, 49); 35 | s2.set(102, 22); 36 | s1.display(); 37 | s2.display(); 38 | } 39 | } -------------------------------------------------------------------------------- /Abstract and Interface/8_1 AbstractClassAndMethods/abstract_demo.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | abstract class Animal{ 3 | abstract public void makeSound(); 4 | } 5 | 6 | abstract class PetAnimal extends Animal{ 7 | 8 | public void getType(){ 9 | System.out.println("This is a Pet Animal"); 10 | } 11 | } 12 | class Dog extends PetAnimal{ 13 | public void makeSound(){ 14 | System.out.println("Bow...Wow"); 15 | } 16 | } 17 | 18 | class Cat extends PetAnimal{ 19 | public void makeSound(){ 20 | System.out.println("Meow...Meow"); 21 | } 22 | } 23 | 24 | class AbstractDemo{ 25 | public static void main(String [] args){ 26 | Scanner sc = new Scanner(System.in); 27 | System.out.println("Please Enter 1 to select Dog and 2 to select Cat"); 28 | int choice = sc.nextInt(); 29 | PetAnimal a; // = new Animal(); 30 | if (choice == 1) 31 | a = new Dog(); 32 | else 33 | a = new Cat(); 34 | a.makeSound(); 35 | } 36 | } -------------------------------------------------------------------------------- /Object and Classes/6_3 ArrayOfObjects/array_refernce_demo.java: -------------------------------------------------------------------------------- 1 | class ArrayDemo{ 2 | public static void main(String [] args){ 3 | Employee e[]; 4 | e = new Employee[5]; 5 | for (int i=0;i<5;i++){ 6 | e[i] = new Employee(); 7 | e[i].setEmployee(i+1,10000*(i+1)); 8 | } 9 | 10 | /*for (int i=0;i<5;i++) 11 | e[i].printEmployee();*/ 12 | //e[3].printEmployee(); 13 | for (int i=0;i num2) : "+(num1 > num2)); 12 | System.out.println(); 13 | System.out.println("This is Less Than Equal To Operator (num1 <= num2) : "+(num1 <= num2)); 14 | System.out.println(); 15 | System.out.println("This is Greater Than Equal To Operator (num1 >= num2) : "+(num1 < num2)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Exception Handling/10_6 Custom Exception/CustomExceptionDemo1.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | class InvalidRollNoException extends RuntimeException{ 3 | public String toString(){ 4 | return "Roll Number should be of range 1 to 75"; 5 | } 6 | } 7 | 8 | class Student{ 9 | int rollNo; 10 | String name; 11 | 12 | public Student(int rollNo, String name){ 13 | try{ 14 | if ((rollNo <= 0) || (rollNo > 75)) 15 | throw new InvalidRollNoException(); 16 | this.rollNo = rollNo; 17 | this.name = name; 18 | } 19 | catch(InvalidRollNoException ire){ 20 | System.out.println(ire); 21 | } 22 | } 23 | 24 | public static void main(String [] args){ 25 | Scanner sc = new Scanner(System.in); 26 | System.out.println("Please enter RollNo and Name"); 27 | int r = sc.nextInt(); 28 | String nm = sc.next(); 29 | 30 | Student s = new Student(r,nm); 31 | 32 | System.out.println("One Object is Created"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Methods in Java/5_2 DemonstratingMethods/prime_check.java: -------------------------------------------------------------------------------- 1 | class PrimeCheck{ 2 | public static void main(String [] a){ 3 | int num = 121; 4 | boolean flag = true; 5 | for (int i=2;i<(int)num/2;i++) 6 | if (num % i == 0){ 7 | flag = false; 8 | break; 9 | } 10 | if (flag == true) 11 | System.out.println(num + " is Prime"); 12 | else 13 | System.out.println(num + " is Not Prime"); 14 | 15 | 16 | int num2 = 456; 17 | flag = true; 18 | for (int i=2;i<(int)num2/2;i++) 19 | if (num2 % i == 0){ 20 | flag = false; 21 | break; 22 | } 23 | if (flag == true) 24 | System.out.println(num2 + " is Prime"); 25 | else 26 | System.out.println(num2 + " is Not Prime"); 27 | 28 | int num3 = 324; 29 | flag = true; 30 | for (int i=2;i<(int)num3/2;i++) 31 | if (num3 % i == 0){ 32 | flag = false; 33 | break; 34 | } 35 | if (flag == true) 36 | System.out.println(num3 + " is Prime"); 37 | else 38 | System.out.println(num3 + " is Not Prime"); 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Methods in Java/5_3 MethodOverloading/overloading_demo.java: -------------------------------------------------------------------------------- 1 | import java.lang.Math; 2 | class OverloadingDemo{ 3 | public static void main(String [] args){ 4 | int radius = 20; 5 | 6 | int len=5, wid=3; 7 | int a = 8, b = 3, c = 9; 8 | f(len); 9 | System.out.println("The area of Circle is: " + area(radius)); 10 | //System.out.println("The radius is: " + radius); 11 | System.out.println("The area of Rectangle is: " + area(len,wid)); 12 | System.out.println("The area of Triangle is: " + area(a,b,c)); 13 | } 14 | 15 | static void f(float val){ 16 | System.out.println(val); 17 | } 18 | static float area(int radius){ 19 | float retval = (float) 22/7 * radius; 20 | //radius = radius * 2; 21 | //System.out.println("The radius is: " + radius); 22 | 23 | return retval; 24 | } 25 | 26 | static float area(int l, int w){ 27 | return l * w; 28 | } 29 | 30 | static float area(int a, int b, int c){ 31 | float s = (float)(a + b + c)/2.0f; 32 | return (float) Math.sqrt(s * (s-a) * (s-b) * (s-c)); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Inheritance/7_7_1 ObjectClassAndMethods-Part I/equals_demo.java: -------------------------------------------------------------------------------- 1 | class Rectangle{ 2 | int length; 3 | int width; 4 | 5 | Rectangle(int length, int width) 6 | { 7 | this.length = length; 8 | this.width = width; 9 | } 10 | 11 | public String toString(){ 12 | return "Length:" + length + " Width: " + width; 13 | } 14 | 15 | public boolean equals(Object obj){ 16 | Rectangle r = (Rectangle) obj; 17 | if ((this.length == r.length) && (this.width == r.width)) 18 | return true; 19 | return false; 20 | } 21 | 22 | 23 | public static void main(String [] args){ 24 | Rectangle r1 = new Rectangle(10, 20); 25 | Rectangle r2 = new Rectangle(10, 20); 26 | //Rectangle r3 = r1; 27 | if (r1.equals(r2)) 28 | System.out.println("Both are Equal"); 29 | else 30 | System.out.println("Both are Different"); 31 | 32 | /*String s1 = "Hello"; 33 | String s2 = new String("Hello"); 34 | 35 | if (s1 == s2) 36 | System.out.println("Both are Equal"); 37 | else 38 | System.out.println("Both are Different");*/ 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /Exception Handling/10_3 try catch finally InDetail/TryCatchFinallyInDetailDemo.java: -------------------------------------------------------------------------------- 1 | class TryCatchFinallyInDetailDemo{ 2 | public static void main(String [] args){ 3 | try{ 4 | int a; 5 | int b; 6 | a = Integer.parseInt(args[0]); 7 | b = Integer.parseInt(args[1]); 8 | if ((a == 0) || (b == 0)) 9 | throw new ArithmeticException(); 10 | System.out.println("After Exception in Try Block"); 11 | if ((a < 0) || (b < 0)) 12 | throw new Exception(); 13 | } 14 | catch(ArithmeticException ae){ 15 | System.out.println("Either of the Values entered are Zero"); 16 | //return; 17 | } 18 | catch(ArrayIndexOutOfBoundsException aiob){ 19 | System.out.println("Please provide 2 command line arguments"); 20 | } 21 | catch(NumberFormatException nfe){ 22 | System.out.println("Please provide integer values only"); 23 | } 24 | catch(Exception e){ 25 | System.out.println("Either of the Value entered is less than zero"); 26 | } 27 | finally{ 28 | System.out.println("Finally1: Thank You for using this class"); 29 | } 30 | finally{ 31 | System.out.println("Finally2: Thank You for using this class"); 32 | } 33 | System.out.println("After Finally Block"); 34 | 35 | 36 | } 37 | } -------------------------------------------------------------------------------- /Inheritance/7_1_1 Inheritance-ConceptAndSyntax/inheritance_demo1.java: -------------------------------------------------------------------------------- 1 | class InheritanceDemo1{ 2 | public static void main(String [] args){ 3 | Employee e1 = new Employee(); 4 | FullTimeEmployee ft1 = new FullTimeEmployee(); 5 | e1.setEmployee("E101","Sonal"); 6 | ft1.setFullTimeEmployee("E102","Parth",75000); 7 | 8 | e1.printEmployee(); 9 | ft1.printEmployee(); 10 | } 11 | } 12 | class Employee{ 13 | protected String empId; 14 | protected String empName; 15 | 16 | public void setEmployee(String empId, String empName){ 17 | this.empId = empId; 18 | this.empName = empName; 19 | } 20 | 21 | public void printEmployee(){ 22 | System.out.println("Employee Id: " + empId); 23 | System.out.println("Employee Name: " + this.empName); 24 | } 25 | } 26 | 27 | class FullTimeEmployee extends Employee{ 28 | private double salary; 29 | 30 | public void setFullTimeEmployee(String empId, String empName, double salary){ 31 | //setEmployee(empId, empName); 32 | this.empId = empId; 33 | this.empName = empName; 34 | this.salary = salary; 35 | } 36 | 37 | public void printFullTimeEmployee(){ 38 | printEmployee(); 39 | System.out.println("Employee Salary: " + this.salary); 40 | } 41 | } 42 | 43 | 44 | -------------------------------------------------------------------------------- /Methods in Java/5_3 MethodOverloading/function_overloading_demo.java: -------------------------------------------------------------------------------- 1 | import java.lang.Math; 2 | 3 | class FunctionOverloadingDemo{ 4 | public static void main(String [] args){ 5 | int radius = 5; 6 | int length = 6, width = 7; 7 | int a = 8, b = 9, c = 3; 8 | f(radius); 9 | int ans = f(radius); 10 | System.out.println("The Area of Circle is: " + area(radius)); 11 | System.out.println("The Radius From Main:" + radius); 12 | 13 | System.out.println("The Area of Rectangle is: " + area(length, width)); 14 | System.out.println("The Area of Triangle is: " + area(a,b,c)); 15 | } 16 | 17 | /*static void f(int val){ 18 | System.out.println(val); 19 | }*/ 20 | 21 | static int f(int val){ 22 | val = val + 10; 23 | return val; 24 | } 25 | 26 | 27 | 28 | 29 | static float area(int radius){ 30 | float ans = 22/7 * radius * radius; 31 | radius = radius * 2; 32 | System.out.println("The Radius within Function:" + radius); 33 | return ans ; 34 | 35 | } 36 | 37 | static float area(int length, int width){ 38 | return length * width; 39 | } 40 | 41 | static float area(int a, int b, int c){ 42 | float s = (float)(a + b + c)/2.0f; 43 | return (float)Math.sqrt(s * (s-a) * (s-b) * (s-c)); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Fundamentals Of Java/src/VariavleAndDataTypesDemo.java: -------------------------------------------------------------------------------- 1 | import java.awt.*; 2 | import java.util.*; 3 | public class VariavleAndDataTypesDemo { 4 | public static void main(String[] args) { 5 | // Primitive Data Type 6 | byte age = 22; 7 | long price = 202; 8 | int reg = 88; 9 | float fee = 10000.00F; 10 | short year = 4; 11 | char gender = 'M'; 12 | boolean isValid = true; 13 | 14 | // souot 15 | System.out.println(age); 16 | System.out.println(price); 17 | System.out.println(reg); 18 | System.out.println(fee); 19 | System.out.println(year); 20 | System.out.println(gender); 21 | System.out.println(isValid); 22 | 23 | // Non Primitives Data Tyoe 24 | String name = "Vivek Pratp Singh"; 25 | System.out.println(name); 26 | Date now = new Date(); 27 | System.out.println(now); 28 | Point point1 = new Point(10,20); 29 | Point point2 = point1; 30 | System.out.println("Point x : "+ point2.x); 31 | System.out.println("Point y : "+ point2.y); 32 | point2.y = 25; 33 | System.out.println("Point x : "+ point2.x); 34 | System.out.println("Point y : "+ point2.y); 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /CollectionFramework/11_7 Collection Framework - SortedMap Interface/SortMapDemo.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | class Student implements Comparable{ 4 | int rollNo; 5 | String name; 6 | 7 | public int compareTo(Object O){ 8 | Student s = (Student) O; 9 | return name.compareTo(s.name); 10 | } 11 | 12 | public Student(int rollNo,String name){ 13 | this.rollNo = rollNo; 14 | this.name = name; 15 | } 16 | 17 | public Student (){} 18 | 19 | public String toString(){ 20 | return rollNo + "-->" + name; 21 | } 22 | } 23 | 24 | 25 | 26 | class SortedMapDemo{ 27 | public static void main(String [] args){ 28 | SortedMap sm = new TreeMap<>(); 29 | Student s1 = new Student(101,"Rupal"); 30 | Student s2 = new Student(102,"Nancy"); 31 | Student s3 = new Student(103,"Akshay"); 32 | Student s4 = new Student(104,"Parth"); 33 | Student s5 = new Student(105,"Stuti"); 34 | sm.put(s1,45); 35 | sm.put(s2,43); 36 | sm.put(s3,49); 37 | sm.put(s4,43); 38 | sm.put(s5,42); 39 | 40 | System.out.println(sm); 41 | 42 | /*System.out.println("Tail Elements:" + sm.tailMap("Pooja")); 43 | System.out.println("Head Elements:" + sm.headMap("Pooja")); 44 | System.out.println("The First Key is:" + sm.firstKey()); 45 | System.out.println("The last Key is:" + sm.lastKey());*/ 46 | 47 | } 48 | } -------------------------------------------------------------------------------- /Inheritance/7_7_2 ObjectClassAndMethods-Part II/clone_demo2.java: -------------------------------------------------------------------------------- 1 | class Name{ 2 | String firstname; 3 | public Name(String fnm){ 4 | firstname = fnm; 5 | } 6 | 7 | public void setName(String fnm){ 8 | firstname = fnm; 9 | } 10 | 11 | public String toString(){ 12 | return firstname; 13 | } 14 | } 15 | 16 | class Student implements Cloneable{ 17 | int rollNo; 18 | Name studName; 19 | 20 | Student(int rollNo, String fnm){ 21 | this.rollNo = rollNo; 22 | this.studName = new Name(fnm); 23 | } 24 | 25 | public void setStudName(String fnm){ 26 | this.studName.setName(fnm); 27 | } 28 | 29 | public Object clone() throws CloneNotSupportedException{ 30 | Student temp = (Student) super.clone(); 31 | temp.studName = new Name(this.studName.firstname); 32 | return temp; 33 | } 34 | 35 | public static void main(String args[]){ 36 | try{ 37 | Student s1 = new Student(101,"Stuti"); 38 | 39 | Student s2 = (Student) s1.clone(); 40 | System.out.println(s1.rollNo + " " + s1.studName); 41 | System.out.println(s2.rollNo + " " + s2.studName); 42 | 43 | s2.rollNo = 102; 44 | s2.setStudName("Stavan"); 45 | 46 | System.out.println(s1.rollNo + " " + s1.studName); 47 | System.out.println(s2.rollNo + " " + s2.studName); 48 | } 49 | catch(CloneNotSupportedException ce){ 50 | System.out.println(ce); 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /Object and Classes/6_1 DeclarationOfClassAndObjects/class_demo.java: -------------------------------------------------------------------------------- 1 | class Student{ 2 | int rollNo; 3 | String name; 4 | float marks; 5 | 6 | void setRollNo(int rn){ 7 | rollNo = rn; 8 | } 9 | 10 | int getRollNo(){ 11 | return rollNo; 12 | } 13 | 14 | void setName(String nm){ 15 | name = nm; 16 | } 17 | 18 | String getName(){ 19 | return name; 20 | } 21 | 22 | void setMarks(float m){ 23 | marks = m; 24 | } 25 | 26 | float getMarks(){ 27 | return marks; 28 | } 29 | 30 | String getGrade(){ 31 | if (marks < 35) 32 | return "Fail"; 33 | return "Pass"; 34 | } 35 | 36 | public static void main(String args[]){ 37 | Student s; 38 | s = new Student(); 39 | s.setRollNo(101); 40 | s.setName("Piyush"); 41 | s.setMarks(45); 42 | 43 | System.out.println("RollNo:" + s.getRollNo()); 44 | System.out.println("Name:" + s.getName()); 45 | System.out.println("Marks:" + s.getMarks()); 46 | System.out.println("Grade:" + s.getGrade()); 47 | 48 | 49 | Student s1; 50 | s1 = new Student(); 51 | s1.setRollNo(102); 52 | s1.setName("Pooja"); 53 | s1.setMarks(85); 54 | 55 | System.out.println("RollNo:" + s1.getRollNo()); 56 | System.out.println("Name:" + s1.getName()); 57 | System.out.println("Marks:" + s1.getMarks()); 58 | System.out.println("Grade:" + s1.getGrade()); 59 | 60 | 61 | } 62 | } 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /Operators/Logicaloperators/src/LogicalOperatorDemo.java: -------------------------------------------------------------------------------- 1 | //Logical Operator 2 | // This is used to perform logical “AND”, “OR” and “NOT” operations, 3 | // i.e. the function similar to AND gate and OR gate in digital electronics. 4 | // These are the Logical Operators 5 | // AND Operator ( && ) – if( a && b ) [if true execute else don’t] 6 | // OR Operator ( || ) – if( a || b) [if one of them is true to execute else don’t] 7 | // NOT Operator ( ! ) – !(a b && a > c){ 21 | System.out.println("A is Greater"); 22 | } 23 | else if (b > a && b > c) { 24 | System.out.println("B is Greater"); 25 | } 26 | else{ 27 | System.out.println("C is Greater "); 28 | } 29 | } 30 | public static void logicalOROperator(int a, int b, int c){ 31 | if ((a > b) || (a > c)){ 32 | System.out.println(a+b+c); 33 | } 34 | else { 35 | System.out.println(a+b+c); 36 | } 37 | } 38 | public static void logicalNotOperator(int a, int b, int c){ 39 | System.out.println((a+b) != c); 40 | System.out.println((a+b)!= (b+c)); 41 | } 42 | } -------------------------------------------------------------------------------- /CollectionFramework/11_6_2 CollectionFramework MapInterface - Demo/MapDemo.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class Student{ 3 | int rollNo; 4 | String name; 5 | 6 | public Student(int rollNo, String name){ 7 | this.rollNo = rollNo; 8 | this.name = name; 9 | } 10 | 11 | public Student(){} 12 | 13 | public String toString(){ 14 | return rollNo + "-->" + name; 15 | } 16 | } 17 | 18 | class MapDemo{ 19 | public static void main(String [] args){ 20 | Student s1 = new Student(101,"Sonal"); 21 | Student s2 = new Student(102,"Parth"); 22 | Student s3 = new Student(103,"Prarthana"); 23 | Student s4 = new Student (104,"Sandeepta"); 24 | 25 | TreeMap college = new TreeMap(); 26 | college.put(3,s3); 27 | college.put(2,s2); 28 | college.put(1,s1); 29 | 30 | for(int i=0;i> entries_college = college.entrySet(); 45 | 46 | Iterator> iter = entries_college.iterator(); 47 | 48 | while(iter.hasNext()){ 49 | Map.Entry kvpair = iter.next(); 50 | Integer iKey = kvpair.getKey(); 51 | Student s = kvpair.getValue(); 52 | System.out.println(iKey + "-----" + s); 53 | } 54 | System.out.println("Is Map Empty? " + college.isEmpty()); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Inheritance/7_5 MethodOverridingInJava/method_ovreriding_demo2.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | class MethodOverridingDemo2{ 3 | public static void main(String [] args){ 4 | Scanner sc = new Scanner(System.in); 5 | System.out.println("Enter 1 to create Batsman and 2 to create Bowler"); 6 | int choice = sc.nextInt(); 7 | sc.close(); 8 | 9 | Cricketer c; 10 | if (choice == 1) 11 | c = new Batsman("India","Rohit Sharma",4,2); 12 | else 13 | c = new Bowler("India","Irfan Pathan",4,10); 14 | c.print(); 15 | } 16 | } 17 | 18 | class Cricketer{ 19 | String countryName; 20 | String playerName; 21 | 22 | public Cricketer(String countryName, String playerName){ 23 | this.countryName = countryName; 24 | this.playerName = playerName; 25 | } 26 | 27 | public void print(){ 28 | System.out.println("County Name:" + countryName); 29 | System.out.println("Player Name:" + playerName); 30 | } 31 | } 32 | 33 | class Batsman extends Cricketer{ 34 | int no50s; 35 | int no100s; 36 | 37 | public Batsman(String countryName, String playerName, int no50s, int no100s){ 38 | super(countryName, playerName); 39 | this.no100s = no100s; 40 | this.no50s = no50s; 41 | } 42 | 43 | public void print(){ 44 | super.print(); 45 | System.out.println("No of 50s:" + no50s); 46 | System.out.println("No of 100s:" + no100s); 47 | } 48 | } 49 | 50 | class Bowler extends Cricketer{ 51 | int wickets; 52 | int runsGiven; 53 | 54 | public Bowler(String countryName, String playerName, int wickets, int runsGiven){ 55 | super(countryName, playerName); 56 | this.wickets = wickets; 57 | this.runsGiven = runsGiven; 58 | } 59 | public void print(){ 60 | super.print(); 61 | System.out.println("No. of Wickets Taken:" + wickets); 62 | System.out.println("No of runs Given:" + runsGiven); 63 | } 64 | } 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /CollectionFramework/11_5 Collection Framework - SortedSet Interface/SortedSetDemo.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | class Student implements Comparable{ 4 | int rollNo; 5 | String name; 6 | 7 | public int compareTo(Object O){ 8 | Student s = (Student) O; 9 | //return name.compareTo(s.name); 10 | if (this.rollNo == s.rollNo) 11 | return 0; 12 | else if (this.rollNo < s.rollNo) 13 | return -1; 14 | else 15 | return 1; 16 | } 17 | 18 | public Student(int rollNo, String name){ 19 | this.rollNo = rollNo; 20 | this.name = name; 21 | } 22 | 23 | public String toString(){ 24 | return rollNo + "-->" + name; 25 | } 26 | } 27 | 28 | class SortedSetDemo{ 29 | public static void main(String [] args){ 30 | TreeSet college = new TreeSet(); 31 | Student s1 = new Student(101,"Reeta"); 32 | Student s2 = new Student(102,"Seeta"); 33 | Student s3 = new Student(103,"Neeta"); 34 | Student s4 = new Student(104,"Meeta"); 35 | Student s5 = new Student(105,"Ariha"); 36 | 37 | college.add(s3); 38 | college.add(s1); 39 | college.add(s5); 40 | 41 | System.out.println(college); 42 | 43 | college.add(s4); 44 | college.add(s2); 45 | System.out.println("After adding two Student"); 46 | System.out.println(college); 47 | 48 | 49 | /*TreeSet ts1 = new TreeSet(); 50 | ts1.add(40); 51 | ts1.add(60); 52 | ts1.add(20); 53 | ts1.add(70); 54 | ts1.add(10); 55 | 56 | System.out.println(ts1); 57 | 58 | ts1.add(50); 59 | ts1.add(45); 60 | ts1.add(45); 61 | 62 | System.out.println("After Adding 50 and 45"); 63 | 64 | System.out.println(ts1); 65 | 66 | TreeSet header = (TreeSet) ts1.headSet(45); 67 | System.out.println("Printing Header"); 68 | 69 | System.out.println(header); 70 | 71 | TreeSet trailor = (TreeSet) ts1.tailSet(45); 72 | System.out.println("Printing Trailor"); 73 | 74 | System.out.println(trailor); 75 | 76 | System.out.println("Printing First"); 77 | 78 | System.out.println(ts1.first()); 79 | 80 | System.out.println("Printing Last"); 81 | System.out.println(ts1.last());*/ 82 | 83 | 84 | } 85 | } -------------------------------------------------------------------------------- /CollectionFramework/11_3 ArrayList And Linked List/ListInterfaceDemo.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | class Student{ 4 | int rollNo; 5 | String name; 6 | 7 | public Student(int rollNo, String name){ 8 | this.rollNo = rollNo; 9 | this.name = name; 10 | } 11 | public String toString(){ 12 | return rollNo + "--> " + name; 13 | } 14 | public Student(){} 15 | } 16 | 17 | class ListInterfaceDemo{ 18 | static Student [] arr = new Student[10]; 19 | static Student s; 20 | 21 | public static void main(String [] args){ 22 | int i; 23 | LinkedList tab1 = new LinkedList(); 24 | getData(arr); 25 | for(i = 0;i<10;i++) 26 | tab1.add(arr[i]); 27 | for (i = 0;i<10;i++) 28 | System.out.println(tab1.get(i)); 29 | tab1.add(5, new Student(11,"Darshan")); 30 | 31 | System.out.println(tab1); 32 | 33 | Iterator iter = tab1.iterator(); 34 | 35 | System.out.println("Traversing With Iterator"); 36 | 37 | while(iter.hasNext()){ 38 | Student s = (Student) iter.next(); 39 | System.out.println(s); 40 | } 41 | 42 | Student [] obj1 = new Student[5]; 43 | Student [] obj2 = (Student []) tab1.toArray(obj1); 44 | 45 | if (obj1 == obj2) 46 | System.out.println("Obj1 and Obj2 are same"); 47 | else 48 | System.out.println("Obj1 and Obj2 are not same"); 49 | 50 | List subLi = tab1.subList(2,5); 51 | ListIterator li = subLi.listIterator(); 52 | 53 | System.out.println("Forward Traversal of SubList"); 54 | 55 | while(li.hasNext()){ 56 | Student s = li.next(); 57 | System.out.println(s); 58 | } 59 | //System.out.println("Backward Traversal of SubList"); 60 | 61 | while(li.hasPrevious()){ 62 | Student s = li.previous(); 63 | if (s.rollNo == 4) 64 | li.remove(); 65 | } 66 | System.out.println(subLi); 67 | tab1.remove(8); 68 | System.out.println(tab1); 69 | 70 | 71 | 72 | } 73 | 74 | static void getData(Student [] A){ 75 | A[0] = new Student(1,"Kena"); 76 | A[1] = new Student(2,"Gopi"); 77 | A[2] = new Student(3,"Nilesh"); 78 | A[3] = new Student(4,"Shivani"); 79 | A[4] = new Student(5,"Mayur"); 80 | A[5] = new Student(6,"Devanshi"); 81 | A[6] = new Student(7,"Faizal"); 82 | A[7] = new Student(8,"Geeta"); 83 | A[8] = new Student(9,"Preksa"); 84 | A[9] = new Student(10,"Prakash"); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Java Course Repository 2 | 3 | Welcome to the Java repository! This repository contains the course materials for learning Java programming. Whether you're a beginner or looking to refresh your Java skills, this course covers the fundamentals and advanced concepts to help you become proficient in Java development. 4 | 5 | ## Table of Contents 6 | 7 | 1. [Introduction to Java](#introduction-to-java) 8 | 2. [Getting Started with Java](#getting-started-with-java) 9 | 3. [Fundamentals of Java](#fundamentals-of-java) 10 | 4. [Control Structure of Java](#control-structure-of-java) 11 | 5. [Arrays in Java](#arrays-in-java) 12 | 6. [Methods in Java](#methods-in-java) 13 | 7. [Objects And Classes in Java](#objects-and-classes-in-java) 14 | 8. [Inheritance in Java](#inheritance-in-java) 15 | 9. [Abstract Class and Interface in Java](#abstract-class-and-interface-in-java) 16 | 10. [Packages in Java](#packages-in-java) 17 | 11. [Exception Handling in Java](#exception-handling-in-java) 18 | 12. [Collection Framework in Java](#collection-framework-in-java) 19 | 13. [V/O Packages in Java](#vo-packages-in-java) 20 | 14. [Threads in Java](#threads-in-java) 21 | 15. [Regular Expressions (Regex) in Java](#regular-expressions-regex-in-java) 22 | 16. [Lambda Expression and Functional Interface](#lambda-expression-and-functional-interface) 23 | 24 | ## Course Summary 25 | 26 | This comprehensive Java course covers a wide range of topics, starting from the basics to advanced concepts. By the end of this course, you will have a solid understanding of Java programming, including its syntax, object-oriented principles, exception handling, multithreading, and more. 27 | 28 | Feel free to explore the individual folders for each topic to access code examples, explanations, and additional resources. We hope you enjoy your learning journey with Java! 29 | 30 | ## Contact Information 31 | 32 | For additional support and updates, you can reach me through the following channels: 33 | - **YouTube:** [Vivek Kumar Singh l](https://www.youtube.com/channel/UClhKtACVRfHeYcDiAxngZpQ) 34 | - **Email:** viveksinghpihuli0a@gmail.com 35 | - **GitHub:** [Bholuvivek](https://github.com/Bholuvivek) 36 | - **LinkedIn:** ](https://www.linkedin.com/in/vivekbholu) 37 | - **Instagram:**[vivekbholu] [thevivekbhou](https://www.instagram.com/thevivekbholu) 38 | - **Twitter:** [Bholuvivek](https://twitter.com/Bholuvivek) 39 | 40 | Feel free to connect and stay updated on the latest Java programming content and announcements!! 41 | -------------------------------------------------------------------------------- /Operators/ArithmeticsOperators/src/ArithmecsOperatorDemo.java: -------------------------------------------------------------------------------- 1 | // In this Program I am going to Write Code about Arithmetics Operatio 2 | // First of all What is Arithmetics Operation - So we can say when we perform Mathematical Calculation, 3 | // So We can say this is Arithmetical Operation 4 | // These are the Arithmetical Operators : "+, -, *, %, /" 5 | // "+" is Use for Addition Operation 6 | // "-" is Use for Subtraction Operation 7 | // "*" is Use for Multiplication 8 | // "%" is USe for Modulo or finding the remainder 9 | // "/" is Use for Division Operation 10 | 11 | // This is THe MAin Coding Part 12 | // I am going to write code in the function/ method type 13 | import java.util.*; 14 | public class ArithmecsOperatorDemo { 15 | public static void main(String[] args) { 16 | Scanner in = new Scanner(System.in); 17 | System.out.println("Enter the first Number"); 18 | int num1 = in.nextInt(); 19 | System.out.println("Enter the second Number! "); 20 | int num2 = in.nextInt(); 21 | additionOperator(num1, num2); 22 | subtractionOperator(num1, num2); 23 | multiplicationOprater(num1, num2); 24 | moduloOpretor(num1, num2); 25 | divisionOperator(num1, num2); 26 | 27 | 28 | } 29 | public static void additionOperator(int num1, int num2){ 30 | System.out.println("This is Addition '+' Operator-------------"); 31 | int add = num1 + num2; 32 | System.out.println("Your Addition Operation is :"+add); 33 | } 34 | public static void subtractionOperator(int num1,int num2){ 35 | System.out.println("This is subtraction '-' Operator!---------"); 36 | System.out.println("Your Subtraction Operation is :"+ (num1 - num2)); 37 | } 38 | public static void multiplicationOprater(int num1, int num2){ 39 | System.out.println("This is Multiplication * Operator------- "); 40 | System.out.println("Your Multiplication Operation is :"+(num1 * num2)); 41 | } 42 | public static void moduloOpretor(int num1, int num2){ 43 | System.out.println("This is Modulo or Reminder '%' Operator------"); 44 | System.out.println("Your Modulo is :"+(num1 % num2)); 45 | } 46 | public static void divisionOperator(int num1, int num2){ 47 | System.out.println("This is Division Operator!---------------"); 48 | System.out.println("Your Division is :"+(num1 / num2)); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /Operators/Operator in Java: -------------------------------------------------------------------------------- 1 | # Operators in Java 2 | 3 | In Java, operators are special symbols that perform operations on variables and values. They are used to manipulate data and perform various calculations. Here, we'll explore the types of operators, their definitions, symbols, and use cases. 4 | 5 | ## Types of Operators 6 | 7 | ### 1. Arithmetic Operators 8 | 9 | Arithmetic operators perform mathematical operations on numeric values. 10 | 11 | - **Definition:** Arithmetic operators include addition, subtraction, multiplication, division, and modulus. 12 | - **Symbols:** 13 | - Addition: `+` 14 | - Subtraction: `-` 15 | - Multiplication: `*` 16 | - Division: `/` 17 | - Modulus (remainder): `%` 18 | - **Use Case:** Used for basic mathematical calculations. 19 | 20 | ### 2. Relational Operators 21 | 22 | Relational operators compare two values and return a boolean result. 23 | 24 | - **Definition:** Relational operators include equality, inequality, greater than, less than, greater than or equal to, and less than or equal to. 25 | - **Symbols:** 26 | - Equality: `==` 27 | - Inequality: `!=` 28 | - Greater than: `>` 29 | - Less than: `<` 30 | - Greater than or equal to: `>=` 31 | - Less than or equal to: `<=` 32 | - **Use Case:** Used for making decisions based on conditions. 33 | 34 | ### 3. Logical Operators 35 | 36 | Logical operators perform logical operations on boolean values. 37 | 38 | - **Definition:** Logical operators include AND, OR, and NOT. 39 | - **Symbols:** 40 | - AND: `&&` 41 | - OR: `||` 42 | - NOT: `!` 43 | - **Use Case:** Used for combining and negating conditions. 44 | 45 | ### 4. Assignment Operators 46 | 47 | Assignment operators assign values to variables. 48 | 49 | - **Definition:** Assignment operators include simple assignment (`=`) and compound assignments (`+=`, `-=`, `*=`, `/=`, `%=`). 50 | - **Symbols:** 51 | - Simple Assignment: `=` 52 | - Compound Assignments: `+=`, `-=`, `*=`, `/=`, `%=` 53 | - **Use Case:** Used for assigning and modifying variable values. 54 | 55 | ### 5. Increment and Decrement Operators 56 | 57 | Increment and decrement operators increase or decrease the value of a variable by 1. 58 | 59 | - **Definition:** Increment (`++`) adds 1 to the current value, and decrement (`--`) subtracts 1. 60 | - **Symbols:** 61 | - Increment: `++` 62 | - Decrement: `--` 63 | - **Use Case:** Used for loops and quick value modifications. 64 | 65 | ## Usage 66 | 67 | Understanding these operators is crucial for writing efficient and expressive Java code. They play a vital role in performing operations, making decisions, and managing variables in your programs. 68 | 69 | Feel free to explore code examples and practical applications in the corresponding course materials and code snippets provided in this repository. 70 | -------------------------------------------------------------------------------- /Inheritance/7_2 TypeOfInheritance/inheritance_demo2.java: -------------------------------------------------------------------------------- 1 | class InheritanceDemo2{ 2 | public static void main(String [] args){ 3 | Person p1 = new Person(); 4 | Employee e1 = new Employee(); 5 | FullTimeEmployee ft1 = new FullTimeEmployee(); 6 | PartTimeEmployee pt1 = new PartTimeEmployee(); 7 | p1.setPerson("Krupa","Patna"); 8 | e1.setEmployee("Bhavin","Ahmedabad","E204","Finance"); 9 | ft1.setFullTimeEmployee("Aayush","Jaipur","E342","IT",67000); 10 | pt1.setPartTimeEmployee("Vismay","Alibaug","E126","HR",1500,20); 11 | 12 | 13 | 14 | System.out.println("Person......."); 15 | p1.displayPerson(); 16 | System.out.println("Employee......."); 17 | e1.displayEmployee(); 18 | System.out.println("Full Time Employee......."); 19 | ft1.displayFullTimeEmployee(); 20 | System.out.println("Part Time Employee......."); 21 | pt1.displayPartTimeEmployee(); 22 | } 23 | } 24 | 25 | 26 | 27 | class Person{ 28 | protected String name; 29 | protected String address; 30 | 31 | public void setPerson(String name, String address){ 32 | this.name = name; 33 | this.address = address; 34 | } 35 | 36 | public void displayPerson(){ 37 | System.out.println("Name:" + name); 38 | System.out.println("Address:" + address); 39 | } 40 | } 41 | 42 | class Employee extends Person{ 43 | protected String empId; 44 | protected String department; 45 | 46 | public void setEmployee(String name, String address, String empId, String department){ 47 | setPerson(name, address); 48 | this.empId = empId; 49 | this.department = department; 50 | } 51 | 52 | public void displayEmployee(){ 53 | displayPerson(); 54 | System.out.println("Emp Id:" + empId); 55 | System.out.println("Department:" + department); 56 | } 57 | } 58 | 59 | 60 | class FullTimeEmployee extends Employee{ 61 | double salary; 62 | 63 | public void setFullTimeEmployee(String name, String address, String empId, String department, double salary){ 64 | setEmployee(name,address,empId, department); 65 | this.salary =salary; 66 | } 67 | 68 | public void displayFullTimeEmployee(){ 69 | displayEmployee(); 70 | System.out.println("Salary: Rs." + salary); 71 | } 72 | } 73 | 74 | 75 | class PartTimeEmployee extends Employee{ 76 | double perHour; 77 | int hour; 78 | 79 | public void setPartTimeEmployee(String name, String address, String empId, String department, double perHour, int hour){ 80 | setEmployee(name,address,empId, department); 81 | this.perHour = perHour; 82 | this.hour = hour; 83 | } 84 | 85 | public void displayPartTimeEmployee(){ 86 | displayEmployee(); 87 | System.out.println("Per Hour:" + perHour); 88 | System.out.println("Hour:" + hour); 89 | System.out.println("Wage Given: Rs. " + (perHour * hour)); 90 | } 91 | } -------------------------------------------------------------------------------- /Object and Classes/Readme.md: -------------------------------------------------------------------------------- 1 | # Topics: Object and Classes 2 | 3 | ## Table of Contents 4 | 5 | 1. [Declaration of Class and Objects](#6_1-declaration-of-class-and-objects) 6 | 2. [Access Modifiers in Java](#6_2-access-modifiers-in-java) 7 | 3. [Array of Objects](#6_3-array-of-objects) 8 | 4. [Constructors in Java](#6_4-constructors-in-java) 9 | 5. [this Keyword](#6_5-this-keyword) 10 | 6. [statics Keyword](#6_6-statics-keyword) 11 | 7. [Initializer Blocks](#6_7-initializer-blocks) 12 | 8. [Wrapper Class](#6_8-wrapper-class) 13 | 14 | --- 15 | 16 | ## 6_1 Declaration of Class and Objects 17 | 18 | Explanation of how to declare classes and create objects in Java. 19 | 20 | // Class declaration 21 | public class MyClass { 22 | // Class members (fields, methods, constructors, etc.) 23 | private int myField; 24 | Now Constructor 25 | // Constructor 26 | public MyClass(int value) { 27 | this.myField = value; 28 | } 29 | 30 | // Method 31 | public void myMethod() { 32 | System.out.println("This is a method in MyClass"); 33 | } 34 | } 35 | 36 | 37 | // Creating an object of MyClass 38 | MyClass obj = new MyClass(10); // Invokes the constructor with the specified value 39 | 40 | // Accessing members of the object 41 | obj.myMethod(); // Invokes the method 42 | System.out.println(obj.myField); // Accesses the field 43 | 44 | 45 | ## 6_2 Access Modifiers in Java 46 | 47 | Overview of access modifiers and their usage in Java. 48 | 49 | ## 6_3 Array of Objects 50 | 51 | Explanation of how to create arrays of objects in Java. 52 | 53 | ## 6_4 Constructors in Java 54 | 55 | Discussion on constructors in Java and their usage. 56 | 57 | ## 6_5 this Keyword 58 | 59 | Explanation of the 'this' keyword in Java. 60 | 61 | ## 6_6 statics Keyword 62 | 63 | Understanding the 'static' keyword and its usage in Java. 64 | 65 | ## 6_7 Initializer Blocks 66 | 67 | Information on initializer blocks in Java. 68 | 69 | ## 6_8 Wrapper Class 70 | 71 | Explanation of the Wrapper class and its purpose in Java. 72 | 73 | --- 74 | 75 | 76 | Feel free to explore code examples and practical applications in the corresponding course materials and code snippets provided in this repository. 77 | 78 | 79 | 80 | ## Contact Information 81 | 82 | For additional support and updates, you can reach me through the following channels: 83 | 84 | - **YouTube:** [Your YouTube Channel](https://www.youtube.com/channel/UClhKtACVRfHeYcDiAxngZpQ) 85 | - **Email:** viveksinghpihuli0a@gmail.com 86 | - **GitHub:** [Your GitHub Profile](https://github.com/Bholuvivek) 87 | - **LinkedIn:** [Your LinkedIn Profile](https://www.linkedin.com/in/vivekbholu) 88 | - **Instagram:** [Your Instagram Profile](https://www.instagram.com/thevivekbholu) 89 | - **Twitter:** [Your Twitter Profile](https://twitter.com/Bholuvivek) 90 | 91 | Feel free to connect and stay updated on the latest Java programming content and announcements! 92 | -------------------------------------------------------------------------------- /Operators/Readme.md: -------------------------------------------------------------------------------- 1 | # Operators in Java 2 | 3 | In Java, operators are special symbols that perform operations on variables and values. They are used to manipulate data and perform various calculations. Here, we'll explore the types of operators, their definitions, symbols, and use cases. 4 | 5 | ## Types of Operators 6 | 7 | ### 1. Arithmetic Operators 8 | 9 | Arithmetic operators perform mathematical operations on numeric values. 10 | 11 | - **Definition:** Arithmetic operators include addition, subtraction, multiplication, division, and modulus. 12 | - **Symbols:** 13 | - Addition: `+` 14 | - Subtraction: `-` 15 | - Multiplication: `*` 16 | - Division: `/` 17 | - Modulus (remainder): `%` 18 | - **Use Case:** Used for basic mathematical calculations. 19 | 20 | ### 2. Relational Operators 21 | 22 | Relational operators compare two values and return a boolean result. 23 | 24 | - **Definition:** Relational operators include equality, inequality, greater than, less than, greater than or equal to, and less than or equal to. 25 | - **Symbols:** 26 | - Equality: `==` 27 | - Inequality: `!=` 28 | - Greater than: `>` 29 | - Less than: `<` 30 | - Greater than or equal to: `>=` 31 | - Less than or equal to: `<=` 32 | - **Use Case:** Used for making decisions based on conditions. 33 | 34 | ### 3. Logical Operators 35 | 36 | Logical operators perform logical operations on boolean values. 37 | 38 | - **Definition:** Logical operators include AND, OR, and NOT. 39 | - **Symbols:** 40 | - AND: `&&` 41 | - OR: `||` 42 | - NOT: `!` 43 | - **Use Case:** Used for combining and negating conditions. 44 | 45 | ### 4. Assignment Operators 46 | 47 | Assignment operators assign values to variables. 48 | 49 | - **Definition:** Assignment operators include simple assignment (`=`) and compound assignments (`+=`, `-=`, `*=`, `/=`, `%=`). 50 | - **Symbols:** 51 | - Simple Assignment: `=` 52 | - Compound Assignments: `+=`, `-=`, `*=`, `/=`, `%=` 53 | - **Use Case:** Used for assigning and modifying variable values. 54 | 55 | ### 5. Increment and Decrement Operators 56 | 57 | Increment and decrement operators increase or decrease the value of a variable by 1. 58 | 59 | - **Definition:** Increment (`++`) adds 1 to the current value, and decrement (`--`) subtracts 1. 60 | - **Symbols:** 61 | - Increment: `++` 62 | - Decrement: `--` 63 | - **Use Case:** Used for loops and quick value modifications. 64 | 65 | ## Usage 66 | 67 | Understanding these operators is crucial for writing efficient and expressive Java code. They play a vital role in performing operations, making decisions, and managing variables in your programs. 68 | 69 | Feel free to explore code examples and practical applications in the corresponding course materials and code snippets provided in this repository. 70 | 71 | 72 | ## Contact Information 73 | 74 | For additional support and updates, you can reach me through the following channels: 75 | 76 | - **YouTube:** [Your YouTube Channel](https://www.youtube.com/channel/UClhKtACVRfHeYcDiAxngZpQ) 77 | - **Email:** viveksinghpihuli0a@gmail.com 78 | - **GitHub:** [Your GitHub Profile](https://github.com/Bholuvivek) 79 | - **LinkedIn:** [Your LinkedIn Profile](https://www.linkedin.com/in/vivekbholu) 80 | - **Instagram:** [Your Instagram Profile](https://www.instagram.com/thevivekbholu) 81 | - **Twitter:** [Your Twitter Profile](https://twitter.com/Bholuvivek) 82 | 83 | Feel free to connect and stay updated on the latest Java programming content and announcements! 84 | -------------------------------------------------------------------------------- /Abstract and Interface/8_4 PracticalDemonstrationInterface/interface_demo3.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | class Vehicle{ 4 | int noSeats; 5 | String fuel; 6 | int speed; 7 | 8 | public Vehicle(int noSeats, String fuel, int speed){ 9 | this.noSeats = noSeats; 10 | this.fuel = fuel; 11 | this.speed = speed; 12 | } 13 | 14 | public String toString(){ 15 | return "No of Seats:" + noSeats + " Fuel Used: " + fuel + " Speed: " + speed; 16 | } 17 | } 18 | 19 | interface FlyingObject{ 20 | int maxheight = 20000; 21 | 22 | } 23 | 24 | class Aeroplane extends Vehicle implements FlyingObject{ 25 | int takeoffSpeed; 26 | 27 | public Aeroplane(int noSeats, String fuel, int speed, int takeoffSpeed){ 28 | super(noSeats, fuel, speed); 29 | this.takeoffSpeed = takeoffSpeed; 30 | } 31 | 32 | public String toString(){ 33 | String aeroPrint; 34 | aeroPrint = "Attributes of Aeroplane\n"; 35 | aeroPrint = aeroPrint + "No of Seats:" + noSeats + " Fuel Used: " + fuel + " Speed: " + speed; 36 | aeroPrint = aeroPrint + " Maximum Height: " + maxheight; 37 | aeroPrint = aeroPrint + " TakeOffSpeed: " + takeoffSpeed; 38 | return aeroPrint; 39 | } 40 | } 41 | 42 | class Rocket extends Vehicle implements FlyingObject{ 43 | public Rocket(int noSeats, String fuel, int speed){ 44 | super(noSeats, fuel, speed); 45 | } 46 | } 47 | class Bus extends Vehicle{ 48 | String type ; 49 | 50 | public Bus(int noSeats, String fuel, int speed, String type){ 51 | super(noSeats, fuel, speed); 52 | this.type = type; 53 | } 54 | 55 | public String toString(){ 56 | String aeroPrint; 57 | aeroPrint = "Attributes of Bus\n"; 58 | aeroPrint = aeroPrint + "No of Seats:" + noSeats + " Fuel Used: " + fuel + " Speed: " + speed; 59 | aeroPrint = aeroPrint + " Type" + type; 60 | return aeroPrint; 61 | } 62 | } 63 | 64 | class InterfaceDemo{ 65 | public static void main(String [] args){ 66 | Vehicle v [] = new Vehicle[5]; 67 | 68 | Scanner sc = new Scanner(System.in); 69 | for (int i = 0; i<5;i++){ 70 | System.out.println("Enter 1 to create Bus, 2 to create Aeroplane and 3 to create Rocket"); 71 | int choice = sc.nextInt(); 72 | if (choice == 1){ //user wants to create bus 73 | int seats; 74 | String fuel; 75 | int speed; 76 | String type; 77 | System.out.println("Enter Seats, Fuel, Speed and Type of Bus"); 78 | seats = sc.nextInt(); 79 | fuel = sc.next(); 80 | speed = sc.nextInt(); 81 | type = sc.next(); 82 | v[i] = new Bus(seats, fuel, speed, type); 83 | } 84 | else if (choice == 2){ 85 | int seats; 86 | String fuel; 87 | int speed; 88 | int takeoffSpeed; 89 | System.out.println("Enter Seats, Fuel, Speed and takeoffSpeed of Aeroplane"); 90 | seats = sc.nextInt(); 91 | fuel = sc.next(); 92 | speed = sc.nextInt(); 93 | takeoffSpeed = sc.nextInt(); 94 | v[i] = new Aeroplane(seats, fuel, speed, takeoffSpeed); 95 | } 96 | else{ 97 | int seats; 98 | String fuel; 99 | int speed; 100 | System.out.println("Enter Fuel, Speed of Rocket"); 101 | seats = 4; 102 | fuel = sc.next(); 103 | speed = sc.nextInt(); 104 | 105 | v[i] = new Rocket(seats, fuel, speed); 106 | } 107 | 108 | } 109 | int count = 0; 110 | for (int i = 0; i<5;i++) 111 | { 112 | if (v[i] instanceof FlyingObject) 113 | count ++; 114 | System.out.println(v[i]); 115 | } 116 | System.out.println("Total FlyingObjects are: " + count); 117 | } 118 | } -------------------------------------------------------------------------------- /Inheritance/Readme.md: -------------------------------------------------------------------------------- 1 | # Java Inheritance and Types 2 | 3 | Inheritance is a fundamental concept in Java programming that enables a class to inherit properties and behaviors from another class. This promotes code reusability and helps create a hierarchical structure in object-oriented programming. 4 | 5 | ## Types of Inheritance 6 | 7 | ### 1. Single Inheritance 8 | 9 | In single inheritance, a subclass inherits from only one superclass. This is a straightforward form of inheritance. 10 | 11 | **Example:** 12 | ```java 13 | public class Animal { 14 | // Fields and methods of the Animal class 15 | } 16 | 17 | public class Dog extends Animal { 18 | // Fields and methods specific to the Dog class 19 | } 20 | ``` 21 | ### 2. Multilevel Inheritance 22 | 23 | Multilevel inheritance involves a chain of inheritance where a class extends another class, and then another class extends that class. This creates a hierarchy of classes. 24 | 25 | **Example:** 26 | ```java 27 | public class Animal { 28 | // Fields and methods of the Animal class 29 | } 30 | 31 | public class Mammal extends Animal { 32 | // Fields and methods specific to Mammals 33 | } 34 | 35 | public class Dog extends Mammal { 36 | // Fields and methods specific to Dogs 37 | } 38 | ``` 39 | 3. Hierarchical Inheritance 40 | Hierarchical inheritance is a form of inheritance where multiple classes inherit from a single superclass. This creates a tree-like structure of classes. 41 | 42 | ```java 43 | public class Vehicle { 44 | // Fields and methods common to all vehicles 45 | } 46 | 47 | public class Car extends Vehicle { 48 | // Fields and methods specific to cars 49 | } 50 | 51 | public class Motorcycle extends Vehicle { 52 | // Fields and methods specific to motorcycles 53 | } 54 | ``` 55 | #4 Multiple 56 | - It is not supported diractly but it can be achieve with the help of interface. 57 | - Java supports multiple inheritance through interfaces. A class can implement multiple interfaces to achieve functionality from various sources. 58 | 59 | 60 | **Example** 61 | ```java 62 | public interface Swimmer { 63 | void swim(); 64 | } 65 | 66 | public interface Flyer { 67 | void fly(); 68 | } 69 | 70 | public class Duck implements Swimmer, Flyer { 71 | @Override 72 | public void swim() { 73 | // Swim implementation 74 | } 75 | 76 | @Override 77 | public void fly() { 78 | // Fly implementation 79 | } 80 | } 81 | ``` 82 | 83 | #5. Hybrid Inheritence. 84 | 85 | Hybrid inheritance is a combination of multiple types of inheritance. It often involves a mix of single inheritance, multiple inheritance (through interfaces), and/or multilevel inheritance. 86 | 87 | ```java 88 | public interface Swimmer { 89 | void swim(); 90 | } 91 | 92 | public interface Flyer { 93 | void fly(); 94 | } 95 | 96 | public class Duck implements Swimmer, Flyer { 97 | @Override 98 | public void swim() { 99 | // Swim implementation 100 | } 101 | 102 | @Override 103 | public void fly() { 104 | // Fly implementation 105 | } 106 | } 107 | ``` 108 | 109 | ## Contact Information 110 | 111 | For additional support and updates, you can reach me through the following channels: 112 | 113 | - **YouTube:** [Your YouTube Channel](https://www.youtube.com/channel/UClhKtACVRfHeYcDiAxngZpQ) 114 | - **Email:** viveksinghpihuli0a@gmail.com 115 | - **GitHub:** [Your GitHub Profile](https://github.com/Bholuvivek) 116 | - **LinkedIn:** [Your LinkedIn Profile](https://www.linkedin.com/in/vivekbholu) 117 | - **Instagram:** [Your Instagram Profile](https://www.instagram.com/thevivekbholu) 118 | - **Twitter:** [Your Twitter Profile](https://twitter.com/Bholuvivek) 119 | 120 | Feel free to connect and stay updated on the latest Java programming content and announcements! 121 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------