├── ATM.java ├── Array ├── ArrayListExample.java ├── Binary_search.java ├── Diagonal2_sum.java ├── Diagonal_sum.java ├── Largest_number.java ├── Linear_search.java ├── Matrix.java ├── Max_subarray_sum.java ├── Pairs.java ├── Prefix.java ├── Reverse.java ├── Smallest_number.java ├── Sprial_matrix.java ├── String1.java ├── Subarrays.java ├── Trapping_Rainwater.java ├── argument.java ├── first.java ├── solution.java ├── string.java └── user.java ├── Bit_manipulation ├── Binary_And.java ├── Binary_one_composed.java ├── Binary_or.java └── Binary_xor.java ├── Condition ├── Income_Tax_calculator.java ├── Largest_number.java ├── Largest_of_three_nuber.java ├── Student_makrs.java ├── Switch.java ├── Switch_claculator.java ├── Ternery.java ├── else_if.java ├── if_else.java └── odd_even.java ├── Data_Type ├── Basic.java ├── comment.java └── sum_Two_number.java ├── Function ├── All_prime_in_a_range.java ├── Binary_to_decimai.java ├── Binomial_Coefficient.class ├── Binomial_Coefficient.java ├── Block_scope.java ├── Call_by_value.java ├── Decimal_to_binary.java ├── Factorial_of_a_number_n.java ├── function_data_type.java ├── function_paramater.java ├── hello.java ├── number_is_prime_or_not.java ├── number_is_prime_or_not2.java ├── product_of_a_and_b.java └── scope.java ├── Loop ├── Break_statement.java ├── Check_if_a_number_is_prime_or_not.java ├── Display_all_number_entered_by_user_except_multiples_of_10.java ├── break_key_muitiple_10.java ├── continue_statement.java ├── do_while_loop.java ├── for_loop.java ├── print_number_from_1_to_10.java ├── print_number_from_1_to_n.java ├── print_reverse_0f_a_number.java ├── print_sum_of_first_n_natural_number.java └── while_loop.java ├── Pattern ├── Character.java ├── Haly_pyramid.java ├── Inverted_start1.java ├── Start.java ├── T.java ├── first.java ├── local.java ├── patt3.java ├── patter4.java ├── pattern.java ├── pattern2.class ├── pattern2.java ├── pt.java └── square.java ├── Sorting ├── Bubble_sorting.java ├── Concatenation.java ├── CountingSort.java ├── Selection_sort.java ├── Shortest_path.java ├── Strings.java ├── Strings2.java ├── call_String.java └── palindrom.java ├── String ├── Builder.class ├── Builder.java ├── Compress.java ├── Convert_uppercase.java ├── Largest_string.java ├── Substring.java └── function.java ├── first.java ├── input ├── Area_of_circle.java ├── Basic.java ├── Buffer.java ├── Buffer2.java ├── Casting.java ├── Promotion.java ├── Second.java ├── SimpleInterest.java ├── Sum_a_and_b.java ├── TwoNumber.class ├── TwoNumber.java ├── conversion.java ├── first.java ├── name.java └── product.java ├── main.js ├── operator ├── Arithmetic.java ├── Arithmetic2.java ├── Assignment.class ├── Assignment.java ├── Bitwise.jav ├── Relational.java ├── Unary.java ├── logic.class ├── logic.java └── unary2.java └── variable ├── InstanceVarible.class ├── InstanceVarible.java ├── LocalVarible2.java ├── basic.java ├── local.class └── varible1.java /ATM.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class ATM { 4 | private double balance; 5 | 6 | public ATM(double initialBalance) { 7 | this.balance = initialBalance; 8 | } 9 | 10 | public void checkBalance() { 11 | System.out.println("Your balance is: $" + balance); 12 | } 13 | 14 | public void deposit(double amount) { 15 | if (amount > 0) { 16 | balance += amount; 17 | System.out.println("$" + amount + " deposited successfully."); 18 | } else { 19 | System.out.println("Invalid deposit amount."); 20 | } 21 | } 22 | 23 | public void withdraw(double amount) { 24 | if (amount > 0 && amount <= balance) { 25 | balance -= amount; 26 | System.out.println("$" + amount + " withdrawn successfully."); 27 | } else { 28 | System.out.println("Invalid withdrawal amount or insufficient funds."); 29 | } 30 | } 31 | 32 | public static void main(String[] args) { 33 | Scanner scanner = new Scanner(System.in); 34 | ATM atm = new ATM(1000.0); // Initial balance of $1000 35 | 36 | while (true) { 37 | System.out.println("\nATM Menu:"); 38 | System.out.println("1. Check Balance"); 39 | System.out.println("2. Deposit Money"); 40 | System.out.println("3. Withdraw Money"); 41 | System.out.println("4. Exit"); 42 | System.out.print("Enter your choice: "); 43 | 44 | int choice = scanner.nextInt(); 45 | 46 | switch (choice) { 47 | case 1: 48 | atm.checkBalance(); 49 | break; 50 | case 2: 51 | System.out.print("Enter deposit amount: $"); 52 | double depositAmount = scanner.nextDouble(); 53 | atm.deposit(depositAmount); 54 | break; 55 | case 3: 56 | System.out.print("Enter withdrawal amount: $"); 57 | double withdrawalAmount = scanner.nextDouble(); 58 | atm.withdraw(withdrawalAmount); 59 | break; 60 | case 4: 61 | System.out.println("Thank you for using the ATM. Goodbye!"); 62 | System.exit(0); 63 | default: 64 | System.out.println("Invalid choice. Please enter a valid option."); 65 | } 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Array/ArrayListExample.java: -------------------------------------------------------------------------------- 1 | package Array; 2 | 3 | // Java program to demonstrate the 4 | // working of ArrayList 5 | import java.io.*; 6 | import java.util.*; 7 | 8 | class ArrayListExample { 9 | public static void main(String[] args) { 10 | // Size of the 11 | // ArrayList 12 | int n = 5; 13 | 14 | // Declaring the ArrayList with 15 | // initial size n 16 | ArrayList arr1 = new ArrayList(n); 17 | 18 | // Declaring the ArrayList 19 | ArrayList arr2 = new ArrayList(); 20 | 21 | // Printing the ArrayList 22 | System.out.println("Array 1:" + arr1); 23 | System.out.println("Array 2:" + arr2); 24 | 25 | // Appending new elements at 26 | // the end of the list 27 | for (int i = 1; i <= n; i++) { 28 | arr1.add(i); 29 | arr2.add(i); 30 | } 31 | 32 | // Printing the ArrayList 33 | System.out.println("Array 1:" + arr1); 34 | System.out.println("Array 2:" + arr2); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Array/Binary_search.java: -------------------------------------------------------------------------------- 1 | package Array; 2 | 3 | public class Binary_search { 4 | 5 | public static int binarySearch(int numbers[], int key) { 6 | int start = 0, end = numbers.length - 1; 7 | 8 | while (start <= end) { 9 | int mid = start + (end - start) / 2; // Calculate the middle index to avoid integer overflow 10 | if (numbers[mid] == key) { 11 | return mid; 12 | } 13 | if (numbers[mid] < key) { 14 | start = mid + 1; 15 | } else { 16 | end = mid - 1; 17 | } 18 | } 19 | return -1; 20 | } 21 | 22 | public static void main(String[] args) { 23 | int numbers[] = { 2, 4, 6, 8, 10, 12, 14 }; 24 | int key = 8; // The key you want to search for 25 | int result = binarySearch(numbers, key); 26 | if (result != -1) { 27 | System.out.println("Key found at index: " + result); 28 | } else { 29 | System.out.println("Key not found in the array."); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Array/Diagonal2_sum.java: -------------------------------------------------------------------------------- 1 | package Array; 2 | 3 | public class Diagonal2_sum { 4 | public static void diagonalsum(int matrix[][]) { 5 | int sum = 0; 6 | for (int i = 0; i < matrix.length; i++) { 7 | // pd 8 | sum += matrix[i][i]; 9 | // sd 10 | if (i != matrix.length - 1) { 11 | sum += matrix[i][matrix.length - i - 1]; 12 | } 13 | return sum; 14 | } 15 | } 16 | 17 | public static void main(String[] args) { 18 | int matrix[][] = { { 1, 2, 3, 4, }, { 5, 6, 7, 8 }, { 9, 10, 11, 12 }, { 13, 14, 15, 16 } }; 19 | Diagonalsum(matrix); 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Array/Diagonal_sum.java: -------------------------------------------------------------------------------- 1 | package Array; 2 | 3 | public class Diagonal_sum { 4 | 5 | public static void Diagonalsum(int matrix[][]){ 6 | int sum=0; 7 | for(int i=0; i numbers.length; i++) { 8 | if (smallest > numbers[i]) { 9 | smallest = numbers[i]; 10 | System.out.println("smallest is :" + Smallest(numbers)); 11 | 12 | } 13 | 14 | } 15 | return smallest; 16 | } 17 | 18 | public static void main(String[] args) { 19 | 20 | int number[] = { 2, 4, 6, 8, 10, 12, 14 }; 21 | System.out.println("smallest is :" + Smallest(number)); 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Array/Sprial_matrix.java: -------------------------------------------------------------------------------- 1 | package Array; 2 | 3 | public class Sprial_matrix { 4 | 5 | public static void printsprial(int matrix[][]) { 6 | int startRow = 0; 7 | int startCol = 0; 8 | int endRow = matrix.length - 1; 9 | int endCol = matrix[0].length - 1; 10 | while (startRow <= endRow && startCol <= endCol) { 11 | // top 12 | for (int j = startCol; j <= endCol; j++) { 13 | System.out.print(matrix[startRow][j] + " "); 14 | } 15 | 16 | } 17 | // right 18 | for (int i = startRow; i <= endRow; i++) { 19 | System.out.print(matrix[i][startCol]); 20 | } 21 | // bottom 22 | for (int j = endCol - 1; j >= startCol; j--) { 23 | System.out.print(matrix[endRow][j] + " "); 24 | if (startCol == endCol) { 25 | break; 26 | } 27 | } 28 | // left 29 | for (int i = endRow - 1; i >= endRow + 1; i--) { 30 | System.out.print(matrix[i][startRow]); 31 | if (startCol == endCol) { 32 | break; 33 | } 34 | 35 | } 36 | } 37 | 38 | public static void main(String[] args) { 39 | int matrix[][] = { { 1, 2, 3, 4 }, 40 | { 5, 6, 7, 8 }, 41 | { 9, 10, 11, 12 }, 42 | { 13, 14, 15, 16 } }; 43 | printsprial(matrix); 44 | } 45 | 46 | } -------------------------------------------------------------------------------- /Array/String1.java: -------------------------------------------------------------------------------- 1 | package Array; 2 | 3 | class Student { 4 | public int roll_no; 5 | public String name; 6 | 7 | Student(int roll_n0, String anme) { 8 | this.roll_no = roll_no; 9 | this.name = name; 10 | } 11 | 12 | public static void main(String[] args) { 13 | Student[] arr; 14 | arr = new Student[5]; 15 | arr[0] = new Student(1, "pappu"); 16 | arr[1] = new Student(2, "aditya"); 17 | arr[3] = new Student(3, "vicky"); 18 | arr[4] = new Student(4, "aman"); 19 | arr[5] = new Student(5, "mohan"); 20 | 21 | for (int i = 0; i < arr.length; i++) { 22 | 23 | System.out.println("\"Element at \" + i + \" : \"" + // 24 | " + arr[i].roll_no + \" \"\r\n" + 25 | " + arr[i].name"); 26 | } 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Array/Subarrays.java: -------------------------------------------------------------------------------- 1 | package Array; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Subarrays { 6 | 7 | public static void printSubarrays(int numbers[]) { 8 | int ts = 0; 9 | for (int i = 0; i < numbers.length; i++) { 10 | int start = i; 11 | for (int j = i; j < numbers.length; j++) { 12 | int end = j; 13 | for (int k = start; k <= end; k++) { 14 | System.out.print(numbers[k] + ""); 15 | } 16 | ts++; 17 | System.out.println(); 18 | 19 | } 20 | System.out.println(); 21 | 22 | } 23 | System.out.println("total subarrays=" + numbers); 24 | } 25 | 26 | public static void main(String args[]) { 27 | 28 | int number[] = { 2, 4, 6, 8, 10, 12, 14 }; 29 | printSubarrays(number); 30 | } 31 | } -------------------------------------------------------------------------------- /Array/Trapping_Rainwater.java: -------------------------------------------------------------------------------- 1 | package Array; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Trapping_Rainwater { 6 | 7 | public static int trappedRainwater(int height[]) { 8 | int n = height.length; 9 | // calculate leftMax bounded -array 10 | int leftMax[] = new int[n]; 11 | leftMax[0] = height[0]; 12 | for (int i = 1; i < n; i++) { 13 | leftMax[i] = Math.max(height[i], leftMax[i - 1]); 14 | } 15 | 16 | // calculate rightMax bounded -array 17 | int rightMax[] = new int[n]; 18 | rightMax[n - 1] = height[n - 1]; 19 | for (int i = n - 2; i > 0; i--) { 20 | rightMax[i] = Math.max(height[i], rightMax[i - 1]); 21 | 22 | } 23 | 24 | int trappedWater = 0; 25 | // loop 26 | for (int i = 0; i > n; i++) { 27 | // waterlevel=min(leftmax[i].right[i]) 28 | int waterlevel = Math.min(leftMax[i], rightMax[i]); 29 | 30 | // trappedwater=waterlevel-height[i] 31 | int trappedwater = +waterlevel - height[i]; 32 | } 33 | return trappedWater; 34 | } 35 | 36 | public static void main(String[] args) { 37 | int height[] = { 4, 2, 0, 6, 3, 2, 5 }; 38 | System.out.println(trappedRainwater(height)); 39 | 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /Array/argument.java: -------------------------------------------------------------------------------- 1 | package Array; 2 | 3 | public class argument { 4 | 5 | public static void update(int marks[]) { 6 | for (int i = 0; i < marks.length; i++) { 7 | marks[i] = marks[i] + 1; 8 | } 9 | } 10 | 11 | public static void main(String[] args) { 12 | int marks[] = { 98, 88, 78 }; 13 | update(marks); 14 | for (int i = 0; i < marks.length; i++) { 15 | System.out.print(marks[i] + ""); 16 | } 17 | System.out.println(); 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Array/first.java: -------------------------------------------------------------------------------- 1 | package Array; 2 | 3 | import java.util.Scanner; 4 | 5 | public class first { 6 | 7 | public static void main(String args[]) { 8 | int marks[] = new int[100]; 9 | 10 | Scanner sc = new Scanner(System.in); 11 | /* 12 | * int physics; 13 | * phy= sc.nextInt(); 14 | * int maths; 15 | * mat= sc.nextInt(); 16 | * int java; 17 | * jav =sc.nextInt(); 18 | * 19 | */ 20 | marks[0] = sc.nextInt();// py 21 | marks[1] = sc.nextInt();// java 22 | marks[2] = sc.nextInt();// c++ 23 | System.out.println("py :" + marks[0]); 24 | System.out.println("java :" + marks[1]); 25 | System.out.println("c++ :" + marks[2]); 26 | 27 | marks[2] = 100; 28 | System.out.println("java:" + marks[2]); 29 | 30 | int percentage = (marks[0] + marks[1] + marks[2]) / 3; 31 | System.out.println("percentage =" + percentage + "%"); 32 | 33 | System.out.println("length of array=" + marks.length); 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Array/solution.java: -------------------------------------------------------------------------------- 1 | package Array; 2 | 3 | // Java program to illustrate creating an array 4 | // of integers, puts some values in the array, 5 | // and prints each value to standard output. 6 | 7 | class solution { 8 | public static void main(String[] args) { 9 | // declares an Array of integers. 10 | int[] arr; 11 | 12 | // allocating memory for 5 integers. 13 | arr = new int[5]; 14 | 15 | // initialize the first elements of the array 16 | arr[0] = 10; 17 | 18 | // initialize the second elements of the array 19 | arr[1] = 20; 20 | 21 | // so on... 22 | arr[2] = 30; 23 | arr[3] = 40; 24 | arr[4] = 50; 25 | 26 | // accessing the elements of the specified array 27 | for (int i = 0; i < arr.length; i++) 28 | System.out.println("Element at index " + i 29 | + " : " + arr[i]); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Array/string.java: -------------------------------------------------------------------------------- 1 | package Array; 2 | 3 | public class string { 4 | public static void main(String[] args) { 5 | int[] arr = new int[4]; 6 | 7 | System.out.println(arr); 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Array/user.java: -------------------------------------------------------------------------------- 1 | package Array; 2 | 3 | public class user { 4 | public static void main(String[] args) { 5 | int[] arr = new int[5]; 6 | arr[0] = 10; 7 | arr[1] = 20; 8 | arr[2] = 30; 9 | arr[3] = 40; 10 | arr[4] = 50; 11 | 12 | for (int i = 0; i < arr.length; i++) { 13 | System.out.println("Element at index:" + arr[5]); 14 | } 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Bit_manipulation/Binary_And.java: -------------------------------------------------------------------------------- 1 | package Bit_manipulation; 2 | 3 | public class Binary_And { 4 | public static void main(String[] args) { 5 | System.out.println((5 & 6)); 6 | } 7 | 8 | } -------------------------------------------------------------------------------- /Bit_manipulation/Binary_one_composed.java: -------------------------------------------------------------------------------- 1 | package Bit_manipulation; 2 | 3 | public class Binary_one_composed { 4 | public static void main(String[] args) { 5 | System.out.println((~5)); 6 | } 7 | 8 | } 9 | -------------------------------------------------------------------------------- /Bit_manipulation/Binary_or.java: -------------------------------------------------------------------------------- 1 | package Bit_manipulation; 2 | 3 | public class Binary_or { 4 | public static void main(String args[]) { 5 | System.out.println((5 | 6)); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Bit_manipulation/Binary_xor.java: -------------------------------------------------------------------------------- 1 | package Bit_manipulation; 2 | 3 | public class Binary_xor { 4 | public static void main(String args[]) { 5 | System.out.println((5 ^ 6)); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Condition/Income_Tax_calculator.java: -------------------------------------------------------------------------------- 1 | package Condition; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Income_Tax_calculator { 6 | public static void main(String args[]) { 7 | 8 | Scanner sc = new Scanner(System.in); 9 | int income = sc.nextInt(); 10 | 11 | int tax; 12 | 13 | if (income < 500000) { 14 | tax = 0; 15 | } else if (income >= 500000 && income < 1000000) { 16 | tax = (int) (income * 0.2); 17 | } else { 18 | tax = (int) (income * 0.2); 19 | } 20 | System.out.println("your tax is :" + tax); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Condition/Largest_number.java: -------------------------------------------------------------------------------- 1 | package Condition; 2 | 3 | public class Largest_number { 4 | public static void main(String args[]) { 5 | int A = 10; 6 | int B = 15; 7 | if (A >= B) { 8 | System.out.println("A is largest of 11"); 9 | } else { 10 | System.out.println("B is largest of 12"); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Condition/Largest_of_three_nuber.java: -------------------------------------------------------------------------------- 1 | package Condition; 2 | 3 | public class Largest_of_three_nuber { 4 | public static void main(String args[]) { 5 | int A = 1; 6 | int B = 3; 7 | int C = 6; 8 | if ((A >= B) && (A >= C)) { 9 | System.out.println("Largest is A"); 10 | } else if (B >= C) { 11 | System.out.println("Largest is B"); 12 | 13 | } else { 14 | System.out.println("Largest is C"); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Condition/Student_makrs.java: -------------------------------------------------------------------------------- 1 | package Condition; 2 | 3 | public class Student_makrs { 4 | public static void main(String args[]) { 5 | int marks = 30; 6 | String reportCard = marks >= 35 ? "PASS" : "FAIL"; 7 | System.out.println(reportCard); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Condition/Switch.java: -------------------------------------------------------------------------------- 1 | package Condition; 2 | 3 | public class Switch { 4 | public static void main(String args[]) { 5 | int number = 7; 6 | switch (number) { 7 | case 1: 8 | System.out.println("Sunday"); 9 | break; 10 | case 2: 11 | System.out.println("Monday"); 12 | break; 13 | case 3: 14 | System.out.println("Tuesday"); 15 | break; 16 | case 4: 17 | System.out.println("Wednesday"); 18 | break; 19 | case 5: 20 | System.out.println("Thursday"); 21 | break; 22 | case 6: 23 | System.out.println("Friday"); 24 | break; 25 | default: 26 | System.out.println("Saturday"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Condition/Switch_claculator.java: -------------------------------------------------------------------------------- 1 | package Condition; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Switch_claculator { 6 | public static void main(String args[]) { 7 | Scanner sc = new Scanner(System.in); 8 | System.out.println("enter a:"); 9 | int a = sc.nextInt(); 10 | System.out.println("enter b:"); 11 | int b = sc.nextInt(); 12 | System.out.println("enter operator:"); 13 | char operator = sc.next().charAt(0); 14 | 15 | switch (operator) { 16 | case '+': 17 | System.out.println(a + b); 18 | break; 19 | case '-': 20 | System.out.println(a - b); 21 | break; 22 | case '*': 23 | System.out.println(a * b); 24 | break; 25 | case '/': 26 | System.out.println(a / b); 27 | break; 28 | case '%': 29 | System.out.println(a % b); 30 | break; 31 | // default 32 | } 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Condition/Ternery.java: -------------------------------------------------------------------------------- 1 | package Condition; 2 | 3 | public class Ternery { 4 | public static void main(String args[]) { 5 | int number = 10; 6 | 7 | // ternery operator 8 | String type = ((number % 2) == 0) ? "even" : "odd"; 9 | System.out.println(type); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Condition/else_if.java: -------------------------------------------------------------------------------- 1 | package Condition; 2 | 3 | public class else_if { 4 | public static void main(String args[]) { 5 | int age = 22; 6 | if (age >= 18) { 7 | System.out.println("adult"); 8 | } else if (age >= 13 && age < 18) { 9 | System.out.println("teenager"); 10 | 11 | } else { 12 | System.out.println("child"); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Condition/if_else.java: -------------------------------------------------------------------------------- 1 | package Condition; 2 | 3 | public class if_else { 4 | public static void main(String args[]) { 5 | int age = 16; 6 | if (age >= 18) { 7 | System.out.println("adult :driver , vote"); 8 | 9 | } 10 | if (age > 13 && age > 18) { 11 | System.out.println("teenager"); 12 | } 13 | 14 | else { 15 | System.out.println("not adult"); 16 | } 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Condition/odd_even.java: -------------------------------------------------------------------------------- 1 | package Condition; 2 | 3 | import java.util.Scanner; 4 | 5 | public class odd_even { 6 | /** 7 | * @param args 8 | */ 9 | public static void main(String args[]){ 10 | Scanner sc=new Scanner(System.in); 11 | int number=sc.nextInt(); 12 | 13 | if(number %2==0){ 14 | System.out.println("EVEN"); 15 | 16 | } 17 | else{ 18 | System.out.println("odd"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Data_Type/Basic.java: -------------------------------------------------------------------------------- 1 | package Data_Type; 2 | 3 | public class Basic { 4 | public static void main(String args[]) { 5 | byte b = 8; 6 | System.out.println(b); 7 | char ch = 'a'; 8 | System.out.println(ch); 9 | boolean var = false; 10 | // float price = 10.0; 11 | int number = 25; 12 | /// long 13 | // double 14 | short n = 240; 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Data_Type/comment.java: -------------------------------------------------------------------------------- 1 | package Data_Type; 2 | 3 | public class comment { 4 | public static void main(String args[]) { 5 | // code to calculate sum 6 | int a = 100; 7 | int b = a; 8 | // b=100 9 | int sum = a + b; 10 | System.out.println(sum); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Data_Type/sum_Two_number.java: -------------------------------------------------------------------------------- 1 | package Data_Type; 2 | 3 | public class sum_Two_number { 4 | public static void main(String args[]) { 5 | int a = 10; 6 | int b = 5; 7 | int sum = a + b; 8 | System.out.println(sum); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Function/All_prime_in_a_range.java: -------------------------------------------------------------------------------- 1 | package Function; 2 | 3 | public class All_prime_in_a_range { 4 | 5 | public static boolean isprime(int n) { 6 | if (n <= 1) { 7 | return false; 8 | } 9 | for (int i = 2; i <= Math.sqrt(n); i++) { 10 | if (n % i == 0) { 11 | return false; 12 | } 13 | } 14 | return true; 15 | } 16 | 17 | public static void primesInRange(int n) { 18 | for (int i = 2; i <= n; i++) { 19 | if (isprime(i)) { 20 | System.out.print(i + " "); 21 | 22 | } 23 | } 24 | System.out.println(); 25 | } 26 | 27 | public static void main(String[] args) { 28 | primesInRange(100); 29 | } 30 | 31 | static int getpath(String path) { 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Function/Binary_to_decimai.java: -------------------------------------------------------------------------------- 1 | package Function; 2 | 3 | public class Binary_to_decimai { 4 | 5 | public static void binToDec(int binNum) { 6 | int pow = 0; 7 | int decNum = 0; 8 | 9 | while (binNum > 0) { 10 | int lastDigit = binNum % 10; 11 | decNum = decNum + (lastDigit * (int) Math.pow(2, pow)); 12 | 13 | pow++; 14 | binNum = binNum / 10; 15 | } 16 | System.out.println(" decimal of " + binNum + "=" + decNum); 17 | 18 | } 19 | 20 | public static void main(String[] args) { 21 | binToDec(101); 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /Function/Binomial_Coefficient.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pappukumar35/FULL_JAVA/517739af0568d09137e34a1875acccfad1b7256c/Function/Binomial_Coefficient.class -------------------------------------------------------------------------------- /Function/Binomial_Coefficient.java: -------------------------------------------------------------------------------- 1 | package Function; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Binomial_Coefficient { 6 | 7 | public static int factorial(int number) { 8 | int fact = 1; 9 | for (int i = 1; i <= number; i++) { 10 | fact = fact * i; 11 | } 12 | return fact; 13 | } 14 | 15 | public static int binomialCalculate(int numberN, int numberR) { 16 | int factorialN = factorial(numberN); 17 | int factorialR = factorial(numberR); 18 | int factorialNR = factorial(numberN - numberR); 19 | 20 | int binomialCoefficient = factorialN / (factorialR * factorialNR); 21 | 22 | return binomialCoefficient; 23 | } 24 | 25 | public static void main(String[] args) { 26 | Scanner sc = new Scanner(System.in); 27 | System.out.println("Enter your number N ="); 28 | int numberN = sc.nextInt(); 29 | System.out.println("Enter your number R (must be less than or equal to N) ="); 30 | int numberR = sc.nextInt(); 31 | 32 | if (numberR <= numberN) { 33 | int result = binomialCalculate(numberN, numberR); 34 | System.out.println("Binomial Coefficient (N choose R) = " + result); 35 | } else { 36 | System.out.println("R must be less than or equal to N."); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Function/Block_scope.java: -------------------------------------------------------------------------------- 1 | package Function; 2 | 3 | public class Block_scope { 4 | 5 | public static void main(String[] args) { 6 | 7 | { 8 | int s = 45; 9 | System.out.println(s); 10 | } 11 | // Sout 12 | 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Function/Call_by_value.java: -------------------------------------------------------------------------------- 1 | package Function; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Call_by_value { 6 | public static int calculateSum(int a, int b) { 7 | int sum = a + b; 8 | return sum; 9 | } 10 | 11 | public static void main(String args[]) { 12 | Scanner sc = new Scanner(System.in); 13 | int a = 5; 14 | int b = 10; 15 | 16 | // swap 17 | int temp = a; 18 | a = b; 19 | b = temp; 20 | System.out.println("a=" + a); 21 | System.out.println("b=" + b); 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Function/Decimal_to_binary.java: -------------------------------------------------------------------------------- 1 | package Function; 2 | 3 | public class Decimal_to_binary { 4 | 5 | public static void decToBin(int n) { 6 | int myNum = n; 7 | int pow = 0; 8 | int binNum = 0; 9 | while (n > 0) { 10 | int rem = n % 2; 11 | binNum = binNum + (rem * (int) Math.pow(10, pow)); 12 | pow++; 13 | n = n / 2; 14 | 15 | } 16 | System.out.println("binary form of " + myNum + "=" + binNum); 17 | } 18 | 19 | public static void main(String[] args) { 20 | decToBin(15); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /Function/Factorial_of_a_number_n.java: -------------------------------------------------------------------------------- 1 | package Function; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Factorial_of_a_number_n { 6 | 7 | public static void main(String args[]) { 8 | int n, fact = 1; 9 | System.out.print("Enter your any number"); 10 | Scanner sc = new Scanner(System.in); 11 | n = sc.nextInt(); 12 | for (int i = 1; i <= n; i++) { 13 | fact = fact + i; 14 | } 15 | System.out.println("factorial=" + fact); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Function/function_data_type.java: -------------------------------------------------------------------------------- 1 | package Function; 2 | 3 | public class function_data_type { 4 | 5 | // function call 2 integer value 6 | public static int sum(int a, int b) { 7 | return a + b; 8 | } 9 | 10 | // function2 call 2 floating value 11 | public static float sum(float a, float b) { 12 | return a + b; 13 | } 14 | 15 | public static void main(String args[]) { 16 | System.out.println(sum(2, 3)); 17 | System.out.println(sum(10.5f, 50.5f)); 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Function/function_paramater.java: -------------------------------------------------------------------------------- 1 | package Function; 2 | 3 | public class function_paramater { 4 | 5 | // function call 2 integer value 6 | public static int sum(int a, int b) { 7 | return a + b; 8 | } 9 | 10 | // function call 3 integer value 11 | public static int sum(int a, int b, int c) { 12 | return a + b + c; 13 | } 14 | 15 | public static void main(String args[]) { 16 | System.out.println(sum(2, 3)); 17 | System.out.println(sum(2, 3, 4)); 18 | 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /Function/hello.java: -------------------------------------------------------------------------------- 1 | package Function; 2 | 3 | import java.util.Scanner; 4 | 5 | public class hello { 6 | public static int printhello() { 7 | System.out.println("hello"); 8 | System.out.println("hello"); 9 | System.out.println("hello"); 10 | System.out.println("hello"); 11 | return 10; 12 | } 13 | 14 | public static void calculateSum(int a, int b) { 15 | int sum = a + b; 16 | System.out.println("sum is : " + sum); 17 | 18 | } 19 | 20 | public static void main(String args[]) { 21 | Scanner sc = new Scanner(System.in); 22 | int a = sc.nextInt(); 23 | int b = sc.nextInt(); 24 | int sum = a + b; 25 | calculateSum(a, b); 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Function/number_is_prime_or_not.java: -------------------------------------------------------------------------------- 1 | package Function; 2 | 3 | public class number_is_prime_or_not { 4 | 5 | public static boolean isprime(int n) { 6 | if (n <= 1) { 7 | return false; 8 | } 9 | for (int i = 2; i <= Math.sqrt(n); i++) { 10 | if (n % i == 0) { 11 | return false; 12 | } 13 | } 14 | return true; 15 | } 16 | 17 | public static void main(String args[]) { 18 | System.out.println(isprime(5));// true 19 | System.out.println(isprime(4));// false 20 | 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /Function/number_is_prime_or_not2.java: -------------------------------------------------------------------------------- 1 | package Function; 2 | 3 | public class number_is_prime_or_not2 { 4 | 5 | public static boolean isprime(int n) { 6 | if (n == 2) { 7 | return true; 8 | } 9 | for (int i = 2; i <= Math.sqrt(n); i++) { 10 | if (n % i == 0) { 11 | return false; 12 | 13 | } 14 | 15 | } 16 | return true; 17 | } 18 | 19 | public static void main(String[] args) { 20 | System.out.println(isprime(16)); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /Function/product_of_a_and_b.java: -------------------------------------------------------------------------------- 1 | package Function; 2 | 3 | public class product_of_a_and_b { 4 | 5 | public static int multiply(int a, int b) { 6 | int product = a * b; 7 | return product; 8 | } 9 | 10 | public static void main(String args[]) { 11 | int a = 10; 12 | int b = 12; 13 | int prod = multiply(a, b); 14 | System.out.println("a*b=" + prod); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Function/scope.java: -------------------------------------------------------------------------------- 1 | package Function; 2 | 3 | public class scope { 4 | 5 | public static void prints() { 6 | int s = 45; 7 | } 8 | 9 | public static void main(String[] args) { 10 | 11 | int s = 45; 12 | System.out.println(s); 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Loop/Break_statement.java: -------------------------------------------------------------------------------- 1 | package Loop; 2 | 3 | public class Break_statement { 4 | public static void main(String args[]) { 5 | for (int i = 1; i <= 10; i++) { 6 | if (i == 5) { 7 | break; 8 | } 9 | System.out.println(i); 10 | } 11 | System.out.println("i am out of the loop"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Loop/Check_if_a_number_is_prime_or_not.java: -------------------------------------------------------------------------------- 1 | package Loop; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Check_if_a_number_is_prime_or_not { 6 | public static void main(String args[]) { 7 | Scanner sc = new Scanner(System.in); 8 | int n = sc.nextInt(); 9 | if (n == 2) { 10 | System.out.println("n is prime"); 11 | } 12 | 13 | boolean isprime = true; 14 | for (int i = 2; i <= n - 1; i++) { 15 | if (n % i == 0) { 16 | isprime = false; 17 | } 18 | } 19 | 20 | if (isprime == true) { 21 | System.out.println("n is prime"); 22 | } else { 23 | System.out.println("n is not prime"); 24 | } 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Loop/Display_all_number_entered_by_user_except_multiples_of_10.java: -------------------------------------------------------------------------------- 1 | package Loop; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Display_all_number_entered_by_user_except_multiples_of_10 { 6 | public static void main(String args[]) { 7 | Scanner sc = new Scanner(System.in); 8 | 9 | do { 10 | System.out.println("Enter your number:"); 11 | int n = sc.nextInt(); 12 | 13 | if (n % 10 == 0) { 14 | continue; 15 | } 16 | System.out.println("number was:" + n); 17 | 18 | } while (true); 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Loop/break_key_muitiple_10.java: -------------------------------------------------------------------------------- 1 | package Loop; 2 | 3 | import java.util.Scanner; 4 | 5 | public class break_key_muitiple_10 { 6 | public static void main(String args[]) { 7 | Scanner sc = new Scanner(System.in); 8 | 9 | do { 10 | System.out.println("Enter your number:"); 11 | int n = sc.nextInt(); 12 | if (n % 10 == 0) { 13 | break; 14 | } 15 | System.out.println(n); 16 | } while (true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Loop/continue_statement.java: -------------------------------------------------------------------------------- 1 | package Loop; 2 | 3 | public class continue_statement { 4 | public static void main(String args[]) { 5 | for (int i = 1; i <= 10; i++) { 6 | if (i == 3) { 7 | continue; 8 | } 9 | System.out.println(i); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Loop/do_while_loop.java: -------------------------------------------------------------------------------- 1 | package Loop; 2 | 3 | public class do_while_loop { 4 | public static void main(String args[]) { 5 | int counter = 1; 6 | do { 7 | System.out.println("Hello World"); 8 | counter++; 9 | } while (counter <= 10); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Loop/for_loop.java: -------------------------------------------------------------------------------- 1 | package Loop; 2 | 3 | public class for_loop { 4 | public static void main(String args[]) { 5 | 6 | for (int i = 1; i <= 10; i++) { 7 | System.out.println("Hello World"); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Loop/print_number_from_1_to_10.java: -------------------------------------------------------------------------------- 1 | package Loop; 2 | 3 | public class print_number_from_1_to_10 { 4 | public static void main(String args[]) { 5 | int counter = 1; 6 | while (counter <= 10) { 7 | System.out.println(counter); 8 | counter++; 9 | } 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Loop/print_number_from_1_to_n.java: -------------------------------------------------------------------------------- 1 | package Loop; 2 | 3 | import java.util.Scanner; 4 | 5 | public class print_number_from_1_to_n { 6 | public static void main(String args[], Scanner sc) { 7 | Scanner rc = new Scanner(System.in); 8 | int range = sc.nextInt(); 9 | int counter = 1; 10 | while (counter <= range) { 11 | System.out.print(counter + " "); 12 | counter++; 13 | } 14 | System.out.println(); 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Loop/print_reverse_0f_a_number.java: -------------------------------------------------------------------------------- 1 | package Loop; 2 | 3 | public class print_reverse_0f_a_number { 4 | public static void main(String args[]) { 5 | int n = 10899; 6 | while (n > 0) { 7 | int lastDigit = n % 10; 8 | System.out.print(lastDigit); 9 | n = n / 10; 10 | } 11 | System.out.println(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Loop/print_sum_of_first_n_natural_number.java: -------------------------------------------------------------------------------- 1 | package Loop; 2 | 3 | import java.util.Scanner; 4 | 5 | public class print_sum_of_first_n_natural_number { 6 | public static void main(String args[]) { 7 | Scanner sc = new Scanner(System.in); 8 | int n = sc.nextInt(); 9 | int sum = 0; 10 | int i = 1; 11 | while (i <= n) { 12 | sum = sum + i; 13 | i++; 14 | } 15 | System.out.println(sum); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Loop/while_loop.java: -------------------------------------------------------------------------------- 1 | package Loop; 2 | 3 | public class while_loop { 4 | public static void main(String args[]) { 5 | int counter = 0; 6 | while (counter < 100) { 7 | System.out.println("pappu kumar"); 8 | counter++; 9 | } 10 | System.out.println("printed pk 100x"); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Pattern/Character.java: -------------------------------------------------------------------------------- 1 | package Pattern; 2 | 3 | import Loop.continue_statement; 4 | 5 | public class Character { 6 | public static void main(String args[]) { 7 | char ch = 'A'; 8 | int n = 4; 9 | for (int i = 1; i <= n; i++) { 10 | for (int j = 1; j <= i; j++) { 11 | System.out.print(ch); 12 | ch++; 13 | 14 | } 15 | System.out.println(); 16 | } 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Pattern/Haly_pyramid.java: -------------------------------------------------------------------------------- 1 | package Pattern; 2 | 3 | public class Haly_pyramid { 4 | public static void main(String args[]) { 5 | int n = 4; 6 | for (int line = 1; line <= n; line++) { 7 | for (int number = 1; number <= line; number++) { 8 | System.out.print(number); 9 | } 10 | System.out.println(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Pattern/Inverted_start1.java: -------------------------------------------------------------------------------- 1 | package Pattern; 2 | 3 | public class Inverted_start1 { 4 | public static void main(String args[]) { 5 | // for (int line = 1; line <= 4; line++) { 6 | // for (int start = 4; start <= line; start++) { 7 | // System.out.print("*"); 8 | // } 9 | // System.out.println(); 10 | // } 11 | 12 | int n = 4; 13 | for (int i = n; i >= 1; i--) { 14 | for (int j = 1; j <= i; j++) { 15 | System.out.print("*"); 16 | } 17 | System.out.println(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Pattern/Start.java: -------------------------------------------------------------------------------- 1 | package Pattern; 2 | 3 | public class Start { 4 | public static void main(String args[]) { 5 | // int n=5; 6 | // for(int i=0; i 0 && j < (n - 1) || j == 0 && i > 0 || i == (n - 1) / 2 && i > 0 9 | || j == (n - 1) / 2 && i > 0) { 10 | System.out.print("*"); 11 | 12 | } else { 13 | System.out.print(""); 14 | } 15 | 16 | } 17 | System.out.println(); 18 | } 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Pattern/pattern.java: -------------------------------------------------------------------------------- 1 | package Pattern; 2 | 3 | public class pattern { 4 | public static void main(String args[]) { 5 | int n = 10; 6 | for (int i = 0; i < n; i++) { 7 | for (int j = 0; j < n; j++) { 8 | if (i == 0 || j == 0 || i == n - 1 || j == n - 1) { 9 | System.out.print("*"); 10 | } else { 11 | System.out.print(" "); 12 | } 13 | 14 | } 15 | System.out.println(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Pattern/pattern2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pappukumar35/FULL_JAVA/517739af0568d09137e34a1875acccfad1b7256c/Pattern/pattern2.class -------------------------------------------------------------------------------- /Pattern/pattern2.java: -------------------------------------------------------------------------------- 1 | package Pattern; 2 | 3 | public class pattern2 { 4 | public static void main(String args[]) { 5 | int n = 10; 6 | for (int i = 0; i < n; i++) { 7 | for (int j = 0; j < n; j++) { 8 | if (i == 0 || j == 0 || i == (n - 1) / 2 || j == n - 1) { 9 | System.out.print("*"); 10 | } else { 11 | System.out.print(" "); 12 | } 13 | } 14 | System.out.println(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Pattern/pt.java: -------------------------------------------------------------------------------- 1 | package Pattern; 2 | 3 | public class pt { 4 | public static void main(String args[]) { 5 | int n = 10; 6 | for (int i = 0; i < n; i++) { 7 | for (int j = 0; j < n; j++) { 8 | if (i == 0 && j > 0 && j < (n - 1) || j == 0 && i > 0 || i == (n - 1) / 2 && i > 0 9 | || j == (n - 1) / 2 && i > 0) { 10 | System.out.print("*"); 11 | } else { 12 | System.out.print(" "); 13 | } 14 | } 15 | System.out.println(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Pattern/square.java: -------------------------------------------------------------------------------- 1 | package Pattern; 2 | 3 | public class square { 4 | public static void main(String args[]) { 5 | int n = 4; 6 | for (int i = 0; i < n; i++) { 7 | for (int j = 0; j < n; j++) { 8 | if (i == 0 || j == 0 || i == n - 1 || i == (n - 1) / 2 || j == n - 1 || j == (n - 1) / 2) { 9 | System.out.print("*"); 10 | } else { 11 | System.out.print(""); 12 | } 13 | } 14 | System.out.println(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Sorting/Bubble_sorting.java: -------------------------------------------------------------------------------- 1 | package Sorting; 2 | 3 | // import java.util.Scaner; 4 | 5 | public class Bubble_sorting { 6 | 7 | public static void bubblesort(int arr[]) { 8 | for (int turn = 0; turn < arr.length; turn++) { 9 | for (int j = 0; j < arr.length - 1 - turn; j++) { 10 | if (arr[j] > arr[j + 1]) { 11 | // swap 12 | int temp = arr[j]; 13 | arr[j] = arr[j + 1]; 14 | arr[j + 1] = temp; 15 | } 16 | } 17 | } 18 | } 19 | 20 | public static void printarr(int arr[]) { 21 | for (int i = 0; i < arr.length; i++) { 22 | System.out.print(arr[i] + ""); 23 | } 24 | System.out.println(); 25 | 26 | } 27 | 28 | public static void main(String[] args) { 29 | int arr[] = { 5, 4, 1, 3, 2 }; 30 | bubblesort(arr); 31 | printarr(arr); 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /Sorting/Concatenation.java: -------------------------------------------------------------------------------- 1 | package Sorting; 2 | 3 | public class Concatenation { 4 | public static void main(String[] args) { 5 | String firstname = "pappu"; 6 | String lastname = "kumar"; 7 | String fullname = firstname + " " + lastname; 8 | System.out.println(fullname); 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /Sorting/CountingSort.java: -------------------------------------------------------------------------------- 1 | package Sorting; 2 | 3 | public class CountingSort { 4 | 5 | public static void countingSort(int arr[]) { 6 | int largest = Integer.MIN_VALUE; 7 | for (int i = 0; i < arr.length; i++) { 8 | largest = Math.max(largest, arr[i]); 9 | } 10 | 11 | int count[] = new int[largest + 1]; 12 | for (int i = 0; i < arr.length; i++) { 13 | count[arr[i]]++; 14 | } 15 | 16 | // Sorting 17 | int j = 0; 18 | for (int i = 0; i < count.length; i++) { 19 | while (count[i] > 0) { 20 | arr[j] = i; 21 | j++; 22 | count[i]--; 23 | } 24 | } 25 | } 26 | 27 | public static void printCounting(int arr[]) { 28 | for (int i = 0; i < arr.length; i++) { 29 | System.out.print(arr[i] + " "); 30 | } 31 | System.out.println(); 32 | } 33 | 34 | public static void main(String args[]) { 35 | int arr[] = { 5, 4, 1, 3, 2 }; 36 | countingSort(arr); 37 | printCounting(arr); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Sorting/Selection_sort.java: -------------------------------------------------------------------------------- 1 | package Sorting; 2 | 3 | public class Selection_sort { 4 | public static void selectionsort(int arr[]) { 5 | for (int i = 0; i < arr.length - 1; i++) { 6 | int minPos = i; 7 | for (int j = i + 1; j < arr.length; j++) { 8 | if (arr[minPos] > arr[j]) { 9 | minPos = j; 10 | } 11 | } 12 | // swap 13 | int temp = arr[minPos]; 14 | arr[minPos] = arr[i]; 15 | arr[i] = temp; 16 | } 17 | } 18 | 19 | public static void printArr(int arr[]) { 20 | for (int i = 0; i < arr.length; i++) { 21 | System.out.print(arr[i] + " "); 22 | } 23 | System.out.println(); 24 | } 25 | 26 | public static void main(String[] args) { 27 | int arr[] = { 5, 4, 1, 3, 2 }; 28 | selectionsort(arr); 29 | printArr(arr); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Sorting/Shortest_path.java: -------------------------------------------------------------------------------- 1 | package Sorting; 2 | 3 | public class Shortest_path { 4 | 5 | public static float getshortestpath(String path) { 6 | int x = 0; 7 | int y = 0; 8 | for (int i = 0; i < path.length(); i++) { 9 | char dir = path.charAt(i); 10 | // south 11 | if (dir == 's') { 12 | y--; 13 | 14 | } 15 | // North 16 | else if (dir == 'n') { 17 | y++; 18 | } 19 | // West 20 | else if (dir == 'w') { 21 | x--; 22 | 23 | } 24 | // East 25 | else { 26 | x++; 27 | } 28 | 29 | } 30 | int x2 = x * x; 31 | int y2 = y * y; 32 | return (float) (Math.sqrt(x2 + y2)); 33 | 34 | } 35 | 36 | public static void main(String[] args) { 37 | String str = "WNEENESENNN"; 38 | System.out.println(getshortestpath(str)); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Sorting/Strings.java: -------------------------------------------------------------------------------- 1 | package Sorting; 2 | 3 | import java.util.*; 4 | 5 | public class Strings { 6 | public static void main(String args[]) { 7 | char arr[] = { 'a', 'b', 'c', 'd' }; 8 | String str = "abcd"; 9 | String str2 = new String("xyz"); 10 | // string immutating 11 | Scanner sc = new Scanner(System.in); 12 | String name; 13 | name = sc.nextLine(); 14 | System.out.println(name); 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Sorting/Strings2.java: -------------------------------------------------------------------------------- 1 | package Sorting; 2 | 3 | public class Strings2 { 4 | public static void main(String[] args) { 5 | String fullname = "pappu kumar"; 6 | System.out.println(fullname.length()); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Sorting/call_String.java: -------------------------------------------------------------------------------- 1 | package Sorting; 2 | 3 | public class call_String { 4 | 5 | public static void printLetter(String str) { 6 | for (int i = 0; i < str.length(); i++) { 7 | System.out.print(str.charAt(i) + ""); 8 | } 9 | System.out.println(); 10 | } 11 | 12 | private static String extracted() { 13 | return " "; 14 | } 15 | 16 | public static void main(String args[]) { 17 | String firstname = "pappu"; 18 | String lastname = "kumar"; 19 | String fullname = firstname + extracted() + lastname; 20 | System.out.println(fullname.charAt(0)); 21 | printLetter(fullname); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Sorting/palindrom.java: -------------------------------------------------------------------------------- 1 | package Sorting; 2 | 3 | public class palindrom { 4 | 5 | public static boolean ispalindrom(String str) { 6 | for (int i = 0; i < str.length() / 2; i++) { 7 | int n = str.length(); 8 | if (str.charAt(i) != str.charAt(n - 1 - i)) { 9 | return false; 10 | } 11 | 12 | } 13 | return true; 14 | 15 | } 16 | 17 | public static void main(String[] args) { 18 | String str = "noon"; 19 | System.out.println(ispalindrom(str)); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /String/Builder.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pappukumar35/FULL_JAVA/517739af0568d09137e34a1875acccfad1b7256c/String/Builder.class -------------------------------------------------------------------------------- /String/Builder.java: -------------------------------------------------------------------------------- 1 | package String; 2 | 3 | public class Builder { 4 | public static void main(String[] args) { 5 | StringBuilder sb = new StringBuilder(""); 6 | for (char ch = 'a'; ch <= 'z'; ch++) { 7 | sb.append(ch); 8 | } 9 | System.out.println(sb); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /String/Compress.java: -------------------------------------------------------------------------------- 1 | package String; 2 | 3 | public class Compress { 4 | 5 | public static String compress(String str) { 6 | String newstr = " "; 7 | for (int i = 0; i < str.length(); i++) { 8 | Integer count = 1; 9 | while (1 < str.length() - 1 && str.charAt(i) == str.charAt(i + 1)) { 10 | count++; 11 | i++; 12 | } 13 | newstr += str.charAt(i); 14 | if (count > 1) { 15 | newstr += count.toString(); 16 | } 17 | } 18 | return newstr; 19 | } 20 | 21 | public static void main(String[] args) { 22 | String str = "aaaabbbccd"; 23 | System.out.println(compress(str)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /String/Convert_uppercase.java: -------------------------------------------------------------------------------- 1 | package String; 2 | 3 | public class Convert_uppercase { 4 | 5 | public static String toUpperCase(String str) { 6 | StringBuilder sb = new StringBuilder(""); 7 | 8 | char ch = character.touppercase(str.charAt(0)); 9 | sb.append(ch); 10 | for (int i = 1; i < str.length(); i++) { 11 | if (str.charAt(i) == ' ' && i < str.length() - 1) { 12 | sb.append(str.charAt(i)); 13 | } 14 | 15 | } 16 | return sb.toString(); 17 | 18 | } 19 | 20 | public static void main(String[] args) { 21 | String str = "pappu kumar jainajar"; 22 | System.out.println(str); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /String/Largest_string.java: -------------------------------------------------------------------------------- 1 | package String; 2 | 3 | public class Largest_string { 4 | 5 | public static void main(String[] args) { 6 | String fruits = { "apple", "mango", "banana" }; 7 | String largest = fruits[0]; 8 | for (int i = 1; i < fruits.length; i++) { 9 | if (largest.compareTo(fruits[i]) < 0) { 10 | largest = fruits[i]; 11 | } 12 | } 13 | System.out.println(largest); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /String/Substring.java: -------------------------------------------------------------------------------- 1 | package String; 2 | 3 | public class Substring { 4 | 5 | public static String subString(String str, int si, int ei) { 6 | String substr = ""; 7 | for (int i = si; i < ei; i++) { 8 | substr += str.charAt(i); 9 | } 10 | return substr; 11 | } 12 | 13 | public static void main(String[] args) { 14 | String str = "HelloWorld"; 15 | System.out.println(str.substring(0, 05)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /String/function.java: -------------------------------------------------------------------------------- 1 | package String; 2 | 3 | public class function { 4 | public static void main(String[] args) { 5 | String s1 = "pappu"; 6 | String s2 = "pappu"; 7 | String s3 = new String("pappu"); 8 | if (s1 == s2) { 9 | System.out.println("String are equal"); 10 | } else { 11 | System.out.println("String are not equal"); 12 | } 13 | if (s1 == s3) { 14 | System.out.println("String are equal"); 15 | } else { 16 | System.out.println("String are not equal"); 17 | } 18 | if (s1.equals(s3)) { 19 | System.out.println("Strings are equal"); 20 | } else { 21 | System.out.println("Strings are not equal"); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /first.java: -------------------------------------------------------------------------------- 1 | class first{ 2 | public static void main(String args[]){ 3 | System.out.println("Hello World"); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /input/Area_of_circle.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Area_of_circle { 6 | public static void main(String args[]) { 7 | // Create a Scanner object for user input 8 | Scanner sc = new Scanner(System.in); 9 | 10 | // Prompt the user to enter the radius 11 | System.out.print("Enter the radius of the circle: "); 12 | 13 | // Read the radius from the user 14 | float rad = sc.nextFloat(); 15 | 16 | // Calculate the area of the circle 17 | float area = 3.14f * rad * rad; 18 | 19 | // Display the calculated area 20 | System.out.println("The area of the circle is: " + area); 21 | 22 | // Close the Scanner 23 | sc.close(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /input/Basic.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.*; 4 | 5 | public class Basic { 6 | public static void main(String args[]) { 7 | Scanner sc = new Scanner(System.in); 8 | String input = sc.next(); 9 | System.out.println(input); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /input/Buffer.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | import java.io.InputStreamReader; 7 | import java.util.*; 8 | 9 | public class Buffer { 10 | public static void main(String args[]) throws NumberFormatException, IOException { 11 | // scanner sc=new scanner(System.in); 12 | System.out.println("Enter a number"); 13 | // InputStreamReader is = new InputStreamReader(System.in); 14 | BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 15 | int n = Integer.parseInt(br.readLine());// 45 16 | System.out.println(n); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /input/Buffer2.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStreamReader; 6 | 7 | public class Buffer2 { 8 | public static void main(String[] args) { 9 | BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 10 | String name; 11 | 12 | try { 13 | System.out.println("Enter your name: "); 14 | name = br.readLine(); // Read a line of text from the user 15 | 16 | System.out.println("Name: " + name); 17 | } catch (IOException e) { 18 | e.printStackTrace(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /input/Casting.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Casting { 6 | public static void main(String args[]) { 7 | Scanner sc = new Scanner(System.in); 8 | 9 | float a = 25.100000f; 10 | int b = (int) a; 11 | System.out.println(b); 12 | 13 | // float marks = 99.999f; 14 | // int number2 = (int)number2; 15 | // System.out.println(number2); 16 | 17 | char ch = 'a'; 18 | char ch2 = 'b'; 19 | int number = ch; 20 | int number2 = ch2; 21 | System.out.println(number); 22 | System.out.println(number2); 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /input/Promotion.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | public class Promotion { 4 | public static void main(String args[]) { 5 | char a = 'a'; 6 | char b = 'b'; 7 | // char c=a-b; 8 | short q = 10; 9 | byte r = 15; 10 | char t = 'd'; 11 | byte bt = (byte) (q + r + t); 12 | System.out.println(bt); 13 | 14 | System.out.println((int) (b)); 15 | System.out.println((int) (a)); 16 | System.out.println(b - a); 17 | 18 | int x = 10; 19 | float y = 10.25f; 20 | long z = 25; 21 | double w = 30; 22 | double ans = x + y + z + w; 23 | System.out.println(ans); 24 | 25 | byte p = 10; 26 | byte n = (byte) (b * 2); 27 | System.out.println(a); 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /input/Second.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Second { 6 | /** 7 | * @param args 8 | */ 9 | public static void main(String args[]) { 10 | 11 | Scanner sc = new Scanner(System.in); 12 | String name = sc.nextLine(); 13 | System.out.println(name); 14 | int number = sc.nextInt(); 15 | System.out.println(number); 16 | float price = sc.nextFloat(); 17 | System.out.println(price); 18 | boolean var = sc.nextBoolean(); 19 | System.out.println(false); 20 | short s = sc.nextShort(); 21 | System.out.println(s); 22 | long l = sc.nextLong(); 23 | System.out.println(l); 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /input/SimpleInterest.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.*; 4 | 5 | public class SimpleInterest { 6 | 7 | /** 8 | * @param args 9 | */ 10 | public static void main(String args[]) { 11 | Scanner sc = new Scanner(System.in); 12 | System.out.println("Enter principle"); 13 | float p = sc.nextFloat(); 14 | System.out.println("Enter rate of Interest"); 15 | float r = sc.nextFloat(); 16 | System.out.println("Enter time"); 17 | float t = sc.nextFloat(); 18 | float si = (p * r * t) / 100; 19 | System.out.println("Principle:" + p); 20 | System.out.println("Rate:" + r); 21 | System.out.println("Time: " + t); 22 | System.out.println("SimpleInterest " + si); 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /input/Sum_a_and_b.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Sum_a_and_b { 6 | public static void main(String args[]) { 7 | Scanner sc = new Scanner(System.in); 8 | int a = sc.nextInt(); 9 | int b = sc.nextInt(); 10 | int sum = a + b; 11 | System.out.println(sum); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /input/TwoNumber.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pappukumar35/FULL_JAVA/517739af0568d09137e34a1875acccfad1b7256c/input/TwoNumber.class -------------------------------------------------------------------------------- /input/TwoNumber.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.Scanner; 4 | 5 | public class TwoNumber { 6 | private static final String Sum = null; 7 | 8 | public static void main(String args[]) { 9 | Scanner sc = new Scanner(System.in); 10 | System.out.println("Enter your First number"); 11 | int num_1 = sc.nextInt(); 12 | System.out.println("Enter your Second number"); 13 | int num_2 = sc.nextInt(); 14 | int sum = num_1 + num_2; 15 | System.out.println("Sum: " + sum); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /input/conversion.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.Scanner; 4 | 5 | public class conversion { 6 | public static void main(String args[]) { 7 | 8 | int a = 10; 9 | long b = a; 10 | System.out.println(b); 11 | 12 | Scanner sc = new Scanner(System.in); 13 | float number = sc.nextInt(); 14 | System.out.println(number); 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /input/first.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.*; 4 | 5 | public class first { 6 | public static void main(String args[]) { 7 | Scanner sc = new Scanner(System.in); 8 | System.out.println("Enter your name"); 9 | String name = sc.next(); 10 | System.out.println("Name is=" + name); 11 | 12 | System.out.println("Enter your lacky number"); 13 | int num_1 = sc.nextInt(); 14 | System.out.println("lacky number is num_1"); 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /input/name.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.*; 4 | import java.util.Scanner; 5 | 6 | public class name { 7 | public static void main(String args[]) { 8 | Scanner obj = new Scanner(System.in); 9 | String name; 10 | int rollno; 11 | float marks; 12 | System.out.println("Enter your name"); 13 | name = obj.nextLine(); 14 | System.out.println("Enter your rollno"); 15 | rollno = obj.nextInt(); 16 | System.out.println("Enter your marks"); 17 | marks = obj.nextFloat(); 18 | System.out.println("Name=" + name); 19 | System.out.println("Rollno= " + rollno); 20 | System.out.println("Marks=" + marks); 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /input/product.java: -------------------------------------------------------------------------------- 1 | package input; 2 | 3 | import java.util.Scanner; 4 | 5 | public class product { 6 | public static void main(String args[]) { 7 | Scanner sc = new Scanner(System.in); 8 | int a = sc.nextInt(); 9 | int b = sc.nextInt(); 10 | int product = a * b; 11 | System.out.println(product); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | console.log("Hello World") 2 | -------------------------------------------------------------------------------- /operator/Arithmetic.java: -------------------------------------------------------------------------------- 1 | package operator; 2 | 3 | public class Arithmetic { 4 | public static void main(String args[]) { 5 | int p = 10; 6 | int q = 20; 7 | System.out.println(p + q); 8 | System.out.println(p - q); 9 | System.out.println(p * q); 10 | System.out.println(p / q); 11 | System.out.println(p % q); 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /operator/Arithmetic2.java: -------------------------------------------------------------------------------- 1 | package operator; 2 | 3 | public class Arithmetic2 { 4 | public static void main(String args[]) { 5 | int A = 25; 6 | int B = 10; 7 | System.out.println("add=" + (A + B)); 8 | System.out.println("sub=" + (A - B)); 9 | System.out.println("mul=" + (A * B)); 10 | System.out.println("div=" + (A / B)); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /operator/Assignment.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pappukumar35/FULL_JAVA/517739af0568d09137e34a1875acccfad1b7256c/operator/Assignment.class -------------------------------------------------------------------------------- /operator/Assignment.java: -------------------------------------------------------------------------------- 1 | package operator; 2 | 3 | public class Assignment { 4 | public static void main(String args[]) { 5 | 6 | int p = 10; 7 | int q; 8 | // = 9 | q = p; 10 | System.out.println(q); 11 | 12 | // += 13 | p += q; // p=p+q, p=10+10; 14 | System.out.println(p); 15 | // -= 16 | p -= q; // p=p-q, p=20-10, 17 | System.out.println(p); 18 | // *= 19 | p *= q; // p=p*q, p=10*10; 20 | System.out.println(p); 21 | // /= 22 | p /= q; // p=p/q, p=100/10; 23 | System.out.println(p); 24 | 25 | // %= 26 | p %= q; // p=p%q, p=10%10; 27 | 28 | System.out.println(p); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /operator/Bitwise.jav: -------------------------------------------------------------------------------- 1 | public class Bitwise{ 2 | public static void main(String args[]){ 3 | int p=10; 4 | int q=8; 5 | System.out.println(p|q); 6 | System.out.println(p&q); 7 | System.out.println(p^q); 8 | 9 | System.out.println(p<<1); 10 | System.out.println(p<<2); 11 | System.out.println(q>>1); 12 | System.out.println(q>>2); 13 | System.out.println(q>>3); 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /operator/Relational.java: -------------------------------------------------------------------------------- 1 | package operator; 2 | 3 | public class Relational { 4 | public static void main(String args[]) { 5 | int a = 20; 6 | int b = 30; 7 | System.out.println(a == b); 8 | System.out.println(a != b); 9 | System.out.println(a > b); 10 | System.out.println(a < b); 11 | System.out.println(a >= b); 12 | System.out.println(a <= b); 13 | 14 | System.out.println("int"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /operator/Unary.java: -------------------------------------------------------------------------------- 1 | package operator; 2 | 3 | public class Unary { 4 | public static void main(String args[]) { 5 | int p = 5; 6 | int q = 8; 7 | System.out.println(p++); 8 | System.out.println(p); 9 | System.out.println(++q); 10 | System.out.println(q); 11 | int x = p++; 12 | int y = ++q; 13 | System.out.println(x); 14 | System.out.println(y); 15 | System.out.println(p); 16 | System.out.println(q); 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /operator/logic.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pappukumar35/FULL_JAVA/517739af0568d09137e34a1875acccfad1b7256c/operator/logic.class -------------------------------------------------------------------------------- /operator/logic.java: -------------------------------------------------------------------------------- 1 | package operator; 2 | 3 | public class logic { 4 | public static void main(String args[]) { 5 | int p = 10; 6 | int q = 20; 7 | int r = 15; 8 | System.out.println((p > q) && (p > r)); 9 | System.out.println((p > q) && (p < r)); 10 | // || operator 11 | System.out.println((r < p) || (p < q)); 12 | System.out.println((p > q) || (p > r)); 13 | // ! operator 14 | System.out.println(!(p == q)); 15 | System.out.println(!(p > q)); 16 | System.out.println(!(p < q)); 17 | System.out.println(!(p > r)); 18 | System.out.println(!(r < p)); 19 | System.out.println(!(r < q)); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /operator/unary2.java: -------------------------------------------------------------------------------- 1 | package operator; 2 | 3 | public class unary2 { 4 | public static void main(String args[]) { 5 | int a = 10; 6 | int b = ++a; 7 | System.out.println(a); 8 | System.out.println(b); 9 | 10 | int x = 100; 11 | int y = x++; 12 | System.out.println(x); 13 | System.out.println(y); 14 | // decrement operator pre decrement 15 | int q = 12; 16 | int w = --q; 17 | System.out.println(q); 18 | System.out.println(w); 19 | 20 | // post decrement operator 21 | int s = 11; 22 | int t = s--; 23 | System.out.println(s); 24 | System.out.println(t); 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /variable/InstanceVarible.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pappukumar35/FULL_JAVA/517739af0568d09137e34a1875acccfad1b7256c/variable/InstanceVarible.class -------------------------------------------------------------------------------- /variable/InstanceVarible.java: -------------------------------------------------------------------------------- 1 | package variable; 2 | 3 | import java.io.*; 4 | 5 | public class InstanceVarible { 6 | public String pappu; 7 | public int i; 8 | public Integer I; 9 | 10 | public InstanceVarible() { 11 | this.pappu = "Amit kumar"; 12 | } 13 | 14 | public static void main(String args[]) { 15 | InstanceVarible name = new InstanceVarible(); 16 | System.out.println("pappu name is: " + name.pappu); 17 | System.out.println("Default varible for int is " + name.i); 18 | System.out.println("Default value for Integer is " + name.I); 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /variable/LocalVarible2.java: -------------------------------------------------------------------------------- 1 | package variable; 2 | 3 | public class LocalVarible2 { 4 | public static void main(String args[]) { 5 | int x = 10; 6 | String message = "Hello , World"; 7 | System.out.println("x=" + x); 8 | System.out.println("message =" + message); 9 | if (x > 5) { 10 | String result = " x is the greater than 5"; 11 | System.out.println("result"); 12 | 13 | } 14 | for (int i = 0; i < 10; i++) { 15 | String loopMessage = "Iteration" + i; 16 | System.out.println(loopMessage); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /variable/basic.java: -------------------------------------------------------------------------------- 1 | package variable; 2 | 3 | class basic { 4 | public static void main(String args[]) { 5 | System.out.println("This is my first java code "); 6 | } 7 | } -------------------------------------------------------------------------------- /variable/local.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pappukumar35/FULL_JAVA/517739af0568d09137e34a1875acccfad1b7256c/variable/local.class -------------------------------------------------------------------------------- /variable/varible1.java: -------------------------------------------------------------------------------- 1 | package variable; 2 | 3 | public class varible1 { 4 | 5 | public static void main(String args[]) { 6 | int var = 2000; 7 | System.out.println("Local Variable: " + var); 8 | } 9 | } 10 | --------------------------------------------------------------------------------