├── array.java ├── notes ├── Arrays.pptx ├── intro-2.pptx ├── java intro.pptx ├── Java Type Casting.pptx ├── String Handling.pptx ├── Control statements.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 ├── TypCast.java ├── StudentImpl.java ├── Strings.java ├── FactImpl.java ├── ArmstrongImpl.java ├── ArithmeticOp.java ├── Primitive.java └── InputMethods.java ├── Wrapper.java ├── Strings ├── StringExam.java └── Stringcomp.java ├── Arrays ├── ComArraym.java ├── Typcast.java ├── ComArray.java ├── IterateArray.java ├── MultiDimArray.java ├── enhanced_for_loop.java └── ConsoleExam.java ├── .gitignore ├── Factorial.java ├── StudentImpl.java ├── Armstrong.java ├── README.md └── .vscode └── launch.json /array.java: -------------------------------------------------------------------------------- 1 | public array{ 2 | public static void main(String[] ar){ 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /notes/Arrays.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sreekar2610/OOP-using-Java/HEAD/notes/Arrays.pptx -------------------------------------------------------------------------------- /notes/intro-2.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sreekar2610/OOP-using-Java/HEAD/notes/intro-2.pptx -------------------------------------------------------------------------------- /notes/java intro.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sreekar2610/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/Java Type Casting.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sreekar2610/OOP-using-Java/HEAD/notes/Java Type Casting.pptx -------------------------------------------------------------------------------- /notes/String Handling.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sreekar2610/OOP-using-Java/HEAD/notes/String Handling.pptx -------------------------------------------------------------------------------- /notes/Control statements.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sreekar2610/OOP-using-Java/HEAD/notes/Control statements.pptx -------------------------------------------------------------------------------- /notes/JP COURSE FILE-converted.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sreekar2610/OOP-using-Java/HEAD/notes/JP COURSE FILE-converted.pdf -------------------------------------------------------------------------------- /notes/operators,expressions,control stmts.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sreekar2610/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 | -------------------------------------------------------------------------------- /Strings/StringExam.java: -------------------------------------------------------------------------------- 1 | class StringExam{ 2 | public static void main(String[] args){ 3 | String str="tonight"; 4 | System.out.println(str.indexOf('u')); 5 | System.out.println(str.indexOf('t',3)); 6 | String subString="ton"; 7 | System.out.println(str.indexOf(subString)); 8 | System.out.println(str.indexOf(subString,7)); 9 | } 10 | } -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /Strings/Stringcomp.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | class Stringcomp{ 3 | public static void main(String[] ar){ 4 | Scanner sc=new Scanner(System.in); 5 | System.out.println("enter your name:"); 6 | String nam=sc.nextLine(); 7 | if(nam.equals("java")){ 8 | System.out.println("good choice"); 9 | } 10 | else{ 11 | System.out.println("you have entered"+nam); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /Arrays/MultiDimArray.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | /** two dimensional array program**/ 3 | class MultiDimArray{ 4 | public static void main(String[] ar){ 5 | int marks[][]=new int[10][2]; 6 | Scanner sc=new Scanner(System.in); 7 | System.out.println("enter roll number and marks"); 8 | for(int i=0;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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Java Programming 2 | This repository is focused on Core to Advanced Java Programming.It covers the OOP concepts, packages,Collections framework, Java Swings. 3 | ## Contributing 4 | 5 | Contributions are always welcome! 6 | 7 | - Create a personal fork of the project on Github.This will create a copy of this repository in your account. 8 | 9 | - Clone the fork on your local machine. Your remote repo on Github is called origin. 10 | 11 | ``` 12 | git clone "url u just copied" 13 | ``` 14 | 15 | - Make necessary changes and commit using 16 | ``` 17 | git add filename 18 | ``` 19 | ``` 20 | git commit -m "msg" 21 | ``` 22 | - Push your changes to github forked repository. 23 | ``` 24 | git push -u origin your-branch-name 25 | ``` 26 | - Submit your changes for a review 27 | ``` 28 | If you go to your repository on GitHub, you'll see a Compare & pull request button. Click on that button. 29 | ``` 30 | - Open a pull request 31 | -Soon I'll be merging all your changes into the main branch of this project. You will get a notification email once the changes have been merged. 32 | -------------------------------------------------------------------------------- /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 | } --------------------------------------------------------------------------------