├── README.md ├── notes ├── Arrays.pptx ├── intro-2.pptx ├── java intro.pptx ├── Control statements.pptx ├── Java Type Casting.pptx ├── JP COURSE FILE-converted.pdf └── operators,expressions,control stmts.pptx ├── basics ├── variables │ ├── StaticVar.java │ ├── CricketerImpl.java │ ├── Cricketer.java │ └── InstanceVar.java ├── HelloWorld.java ├── controlstatements │ ├── EnhancedFor.java │ ├── Ifstmt.java │ ├── WhileExam.java │ ├── NestedIf.java │ └── SwitchCase.java ├── NarrowCastExample.java ├── datatype │ ├── TypeConv.java │ ├── NarrowCastExample.java │ └── Datatype.java ├── StudentImpl.java ├── Strings.java ├── FactImpl.java ├── ArmstrongImpl.java ├── ArithmeticOp.java ├── Primitive.java └── InputMethods.java ├── Wrapper.java ├── Arrays ├── ComArraym.java ├── Typcast.java ├── ComArray.java ├── IterateArray.java ├── enhanced_for_loop.java └── ConsoleExam.java ├── .gitignore ├── Factorial.java ├── Armstrong.java └── .vscode └── launch.json /README.md: -------------------------------------------------------------------------------- 1 | # OOP-Using-Java 2 | Object Oriented Programming Using JAVA 3 | Java_Lab 4 | -------------------------------------------------------------------------------- /notes/Arrays.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siris2204/OOP-using-Java/HEAD/notes/Arrays.pptx -------------------------------------------------------------------------------- /notes/intro-2.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siris2204/OOP-using-Java/HEAD/notes/intro-2.pptx -------------------------------------------------------------------------------- /notes/java intro.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siris2204/OOP-using-Java/HEAD/notes/java intro.pptx -------------------------------------------------------------------------------- /basics/variables/StaticVar.java: -------------------------------------------------------------------------------- 1 | package basics.variables; 2 | 3 | public class StaticVar { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /notes/Control statements.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siris2204/OOP-using-Java/HEAD/notes/Control statements.pptx -------------------------------------------------------------------------------- /notes/Java Type Casting.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siris2204/OOP-using-Java/HEAD/notes/Java Type Casting.pptx -------------------------------------------------------------------------------- /notes/JP COURSE FILE-converted.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siris2204/OOP-using-Java/HEAD/notes/JP COURSE FILE-converted.pdf -------------------------------------------------------------------------------- /notes/operators,expressions,control stmts.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siris2204/OOP-using-Java/HEAD/notes/operators,expressions,control stmts.pptx -------------------------------------------------------------------------------- /basics/HelloWorld.java: -------------------------------------------------------------------------------- 1 | package basics; 2 | class HelloWorld{ 3 | public static void main(String[] args){ 4 | System.out.println("Hello there welcome to java"); 5 | } 6 | } -------------------------------------------------------------------------------- /basics/controlstatements/EnhancedFor.java: -------------------------------------------------------------------------------- 1 | class EnhancedFor{ 2 | public static void main(String[] ar){ 3 | int[] marks={10,20,30,40,50}; 4 | for(int i:marks){ 5 | System.out.println("marks are"+i); 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /Wrapper.java: -------------------------------------------------------------------------------- 1 | class Wrapper 2 | { 3 | public static void main(String[] p) 4 | { System.out.println("Welcome "+p[0]); 5 | int a= Integer.parseInt(p[1]); 6 | int b= Integer.parseInt(p[2]); 7 | System.out.println(a+b); 8 | } 9 | } -------------------------------------------------------------------------------- /basics/NarrowCastExample.java: -------------------------------------------------------------------------------- 1 | package basics; 2 | 3 | public class NarrowCastExample { 4 | public static void main(String[] args) { 5 | int marks=70; 6 | double dmarks=(double)marks; 7 | System.out.println(marks); 8 | System.out.println(dmarks); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /basics/datatype/TypeConv.java: -------------------------------------------------------------------------------- 1 | package basics.datatype; 2 | 3 | public class TypeConv { 4 | public static void main(String[] args) { 5 | int rno=81; 6 | double rnn=rno; 7 | System.out.println(rno);// Automatic casting: int to double 8 | System.out.println(rnn); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /basics/datatype/NarrowCastExample.java: -------------------------------------------------------------------------------- 1 | package basics.datatype; 2 | 3 | public class NarrowCastExample { 4 | public static void main(String[] args) { 5 | int marks=70; 6 | double dmarks=(double)marks; 7 | System.out.println(marks); 8 | System.out.println(dmarks); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Arrays/ComArraym.java: -------------------------------------------------------------------------------- 1 | class ComArraym{ 2 | /* 3 | min array element 4 | */ 5 | static void min(int arr[]){ 6 | int min=arr[0]; 7 | for(int i=1;iarr[i]) 9 | min=arr[i]; 10 | System.out.println(min); 11 | 12 | } 13 | public static void main(String[] args){ 14 | int a[]={33,3,4,5}; 15 | min(a); 16 | } 17 | } -------------------------------------------------------------------------------- /Arrays/Typcast.java: -------------------------------------------------------------------------------- 1 | class TypCast{ 2 | public static void main(String[] args) { 3 | int marks=80; 4 | long lmv=marks; 5 | System.out.println("integer value"+marks); 6 | System.out.println("long value"+lmv); 7 | 8 | float d=129.345; 9 | double inm=(double)d; 10 | System.out.println("double value"+d); 11 | System.out.println("integer value"+inm); 12 | } 13 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | replay_pid* 25 | -------------------------------------------------------------------------------- /Arrays/ComArray.java: -------------------------------------------------------------------------------- 1 | public class ComArray{ 2 | int[] arr3={4,7,3,9,2}; 3 | public static void main(String[] args) { 4 | /*common array element*/ 5 | int[] arr1={4,7,3,9,2}; 6 | int[] arr2={3,2,12,9,40,32,4}; 7 | for(int i=0;i=18){ 9 | System.out.println("You are allowed to vote"); 10 | } 11 | else{ 12 | System.out.println("You are not eligible"); 13 | } 14 | sc.close(); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Armstrong.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | public class Armstrong{ 3 | public static void main(String[] args){ 4 | int sum=0,n,orn; 5 | Scanner sc= new Scanner(System.in); 6 | n= sc.nextInt(); 7 | orn=n; 8 | while(orn!=0){ 9 | int rem=orn%10; 10 | sum+=rem*rem*rem; 11 | orn/=10; 12 | } 13 | if(sum==n){ 14 | System.out.println("It is an Armstrong Number."); 15 | } 16 | else{ 17 | System.out.println("It is not an Armstrong Number."); 18 | } 19 | sc.close(); 20 | } 21 | } -------------------------------------------------------------------------------- /basics/ArmstrongImpl.java: -------------------------------------------------------------------------------- 1 | package basics; 2 | import java.util.*; 3 | public class ArmstrongImpl { 4 | //armstrong number logic 5 | public static void main(String[] ar){ 6 | int sum=0,n,orn; 7 | Scanner sc=new Scanner(System.in); 8 | System.out.println("enter the number:"); 9 | n=sc.nextInt(); 10 | orn=n; 11 | while(orn!=0){ 12 | int rem=orn%10; 13 | sum+=rem*rem*rem; 14 | orn/=10; 15 | 16 | } 17 | if(sum==n){ 18 | System.out.println("armstrong number"); 19 | }else{ 20 | System.out.println("not armstrong number"); 21 | } 22 | sc.close(); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /basics/ArithmeticOp.java: -------------------------------------------------------------------------------- 1 | package basics; 2 | import java.util.*; 3 | class ArithmeticOp{ 4 | public static void main(String[] args){ 5 | Scanner sc=new Scanner(System.in); 6 | System.out.println("enter the two integers"); 7 | int a=sc.nextInt(); 8 | int b=sc.nextInt(); 9 | sc.close(); 10 | Arith a1=new Arith(a,b); 11 | a1.add(); 12 | a1.sub(); 13 | } 14 | } 15 | class Arith{ 16 | int n1,n2; 17 | Arith(int a,int b){ 18 | this.n1=a; 19 | this.n2=b; 20 | } 21 | void add(){ 22 | System.out.println("addition result:"+(n1+n2)); 23 | } 24 | void sub(){ 25 | System.out.println("subtraction result:"+(n1-n2)); 26 | } 27 | } -------------------------------------------------------------------------------- /Arrays/enhanced_for_loop.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class enhanced_for_loop { 4 | public static void main(String[] args) { 5 | Scanner sc = new Scanner(System.in); 6 | int i = 0; 7 | System.out.println("Enter the limit:"); 8 | int n = sc.nextInt(); 9 | System.out.println("Enter the marks:"); 10 | int marks [] = new int [n]; 11 | while (i < n) { 12 | marks [i] = sc.nextInt(); 13 | i++; //incrementing index value 14 | } 15 | System.out.println("The marks are:"); 16 | 17 | //implementing enhanced for loop 18 | for(int nn:marks){ 19 | System.out.println(nn); 20 | } 21 | sc.close(); 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /basics/controlstatements/WhileExam.java: -------------------------------------------------------------------------------- 1 | package basics.controlstatements; 2 | import java.util.*; 3 | /** 4 | * Java program to accept input and store in arrays 5 | */ 6 | public class WhileExam { 7 | public static void main(String[] p){ 8 | Scanner sc=new Scanner(System.in); 9 | int i=0; 10 | System.out.println("enter the limit"); 11 | int n=sc.nextInt(); 12 | System.out.println("enter the marks"); 13 | int marks[]=new int[n]; 14 | while(i System.out.println("addition result is"+(a+b)); 17 | case 2-> System.out.println("subtraction result is"+(a-b)); 18 | case 3-> System.out.println("multiplication result is"+(a*b)); 19 | case 4-> System.out.println("division result is"+(a/b)); 20 | default -> System.out.println("give proper option"); 21 | } 22 | sc.close(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /basics/InputMethods.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class InputMethods { 4 | public static void main(String[] args) { 5 | Scanner scanner = new Scanner(System.in); 6 | 7 | // Basic Input methods 8 | System.out.println("Enter your name: "); 9 | String name = scanner.next(); 10 | scanner.nextLine(); 11 | System.out.println("Enter your college name: "); 12 | String college = scanner.nextLine(); // Read the whole line 13 | System.out.println("Enter your Roll number: "); 14 | int rollNumber = scanner.nextInt(); 15 | System.out.println("Enter your 1st Year marks Percentage: "); 16 | float marks = scanner.nextFloat(); // variable declaration 17 | scanner.close(); 18 | 19 | System.out.println("--------- Your Details ---------\n"); 20 | System.out.println("Name :" + name); 21 | System.out.println("\nCollege : " + college); 22 | System.out.println("\nRoll No : " + rollNumber); 23 | System.out.println("\nPercentage : " + marks); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "type": "java", 5 | "name": "WhileExam", 6 | "request": "launch", 7 | "mainClass": "basics.controlstatements.WhileExam", 8 | "projectName": "OOP-using-Java_b9476530" 9 | }, 10 | { 11 | "type": "java", 12 | "name": "SwitchCase", 13 | "request": "launch", 14 | "mainClass": "basics.controlstatements.SwitchCase", 15 | "projectName": "OOP-using-Java_b9476530" 16 | }, 17 | { 18 | "type": "java", 19 | "name": "Datatype", 20 | "request": "launch", 21 | "mainClass": "basics.datatype.Datatype", 22 | "projectName": "OOP-using-Java_b9476530" 23 | }, 24 | { 25 | "type": "java", 26 | "name": "CricketerImpl", 27 | "request": "launch", 28 | "mainClass": "basics.variables.CricketerImpl", 29 | "projectName": "OOP-using-Java_b9476530" 30 | }, 31 | { 32 | "type": "java", 33 | "name": "InstanceVar", 34 | "request": "launch", 35 | "mainClass": "basics.variables.InstanceVar", 36 | "projectName": "OOP-using-Java_b9476530" 37 | }, 38 | { 39 | "type": "java", 40 | "name": "NestedIf", 41 | "request": "launch", 42 | "mainClass": "basics.controlstatements.NestedIf", 43 | "projectName": "OOP-using-Java_b9476530" 44 | }, 45 | { 46 | "type": "java", 47 | "name": "Ifstmt", 48 | "request": "launch", 49 | "mainClass": "basics.controlstatements.Ifstmt", 50 | "projectName": "OOP-using-Java_b9476530" 51 | }, 52 | { 53 | "type": "java", 54 | "name": "NarrowCastExample", 55 | "request": "launch", 56 | "mainClass": "basics.NarrowCastExample", 57 | "projectName": "OOP-using-Java_b9476530" 58 | }, 59 | { 60 | "type": "java", 61 | "name": "TypeConv", 62 | "request": "launch", 63 | "mainClass": "basics.TypeConv", 64 | "projectName": "OOP-using-Java_b9476530" 65 | }, 66 | { 67 | "type": "java", 68 | "name": "ArmstrongImpl", 69 | "request": "launch", 70 | "mainClass": "basics.ArmstrongImpl", 71 | "projectName": "OOP-using-Java_b9476530" 72 | }, 73 | { 74 | "type": "java", 75 | "name": "FactImpl", 76 | "request": "launch", 77 | "mainClass": "basics.FactImpl", 78 | "projectName": "OOP-using-Java_b9476530" 79 | }, 80 | { 81 | "type": "java", 82 | "name": "StudentImpl", 83 | "request": "launch", 84 | "mainClass": "basics.StudentImpl", 85 | "projectName": "OOP-using-Java_b9476530" 86 | }, 87 | { 88 | "type": "java", 89 | "name": "ArithmeticOp", 90 | "request": "launch", 91 | "mainClass": "basics.ArithmeticOp", 92 | "projectName": "OOP-using-Java_b9476530" 93 | }, 94 | { 95 | "name": "gcc.exe - Build and debug active file", 96 | "type": "cppdbg", 97 | "request": "launch", 98 | "program": "${fileDirname}\\${fileBasenameNoExtension}.exe", 99 | "args": [], 100 | "stopAtEntry": false, 101 | "cwd": "${fileDirname}", 102 | "environment": [], 103 | "externalConsole": true, 104 | "MIMode": "gdb", 105 | "miDebuggerPath": "E:\\CodeBlocks\\MinGW\\bin\\gdb.exe", 106 | "setupCommands": [ 107 | { 108 | "description": "Enable pretty-printing for gdb", 109 | "text": "-enable-pretty-printing", 110 | "ignoreFailures": true 111 | } 112 | ], 113 | "preLaunchTask": "C/C++: gcc.exe build active file" 114 | }, 115 | { 116 | "name": "gcc build & run active file", 117 | "type": "cppdbg", 118 | "request": "launch", 119 | "program": "${fileDirname}\\${fileBasenameNoExtension}.exe", 120 | "args": [], 121 | "stopAtEntry": false, 122 | "cwd": "${fileDirname}", 123 | "environment": [], 124 | "externalConsole": false, 125 | "MIMode": "gdb", 126 | "miDebuggerPath": "E:\\CodeBlocks\\MinGW\\bin\\gdb.exe", 127 | "setupCommands": [ 128 | { 129 | "description": "Enable pretty-printing for gdb", 130 | "text": "-enable-pretty-printing", 131 | "ignoreFailures": true 132 | } 133 | ], 134 | "preLaunchTask": "gcc build & run active file" 135 | } 136 | ] 137 | } --------------------------------------------------------------------------------