This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Scanner; | |
| public class R12 { | |
| } | |
| //structure of a node class for singly linked list | |
| class Node1 | |
| { | |
| int data; | |
| Node1 next; //self referential structure to hold the reference of the next element of the same type. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Scanner; | |
| public class R12 { | |
| } | |
| //structure of a node class for singly linked list | |
| class Node1 | |
| { | |
| int data; | |
| Node1 next; //self referential structure to hold the reference of the next element of the same type. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package WrapperAssignments; | |
| public class WrapperAssign2 { | |
| public static void main(String[] args) { | |
| int a = Integer.parseInt(args[0]); | |
| System.out.println("Given number : "+a); | |
| System.out.println("Binary Equivalent : "+Integer.toBinaryString(a)); | |
| System.out.println("Octal Equivalent : "+Integer.toOctalString(a)); | |
| System.out.println("HexaDecimal Equivalent : "+Integer.toHexString(a)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package WrapperAssignments; | |
| import java.util.Scanner; | |
| public class WrapperAssign3 { | |
| public static void main(String[] args) { | |
| int num = new Scanner(System.in).nextInt(); | |
| if(num>=1 && num<=255) | |
| { | |
| int res = Integer.parseInt(Integer.toBinaryString(num)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Scanner; | |
| class Node { | |
| int data; | |
| Node next; | |
| public Node(int data) { | |
| this.data = data; | |
| } | |
| } | |
| public class Linkedlist12 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package ExceptionAssignments; | |
| import java.util.InputMismatchException; | |
| import java.util.Scanner; | |
| public class ExceptionAssign1 { | |
| public static void main(String[] args) { | |
| Scanner s = new Scanner(System.in); | |
| System.out.println("Enter the number of elements in the array"); | |
| int n = s.nextInt(); | |
| int arr[] = new int[n]; | |
| System.out.println("Enter the elements in the array"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package ExceptionAssignments; | |
| import java.util.InputMismatchException; | |
| import java.util.Scanner; | |
| public class ExceptionAssign1 { | |
| public static void main(String[] args) { | |
| Scanner s = new Scanner(System.in); | |
| System.out.println("Enter the number of elements in the array"); | |
| int n = s.nextInt(); | |
| int arr[] = new int[n]; | |
| System.out.println("Enter the elements in the array"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ArrayAssign10 { | |
| public static int[] check(int[] nums) { | |
| // if there are only two elements in the array then return the array | |
| if (nums.length < 2) return nums; | |
| // result array with same length | |
| int[] result = new int[nums.length]; | |
| // here use two variables using which i am arranging by5 values at right side and | |
| // notby5 values at left side | |
| // notby5 values will arrange from index o and odd values will arrange from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Create an array of 5 elements with values {1,7,4,7,6}.Search value 7 in the given array and print | |
| // all the occurrence(index) of search value(7) by holding the index in a result array . Do it recursively | |
| public class occurrences { | |
| public static int[] sol(int arr[], int ci,int search, int count) | |
| { | |
| // base case | |
| if (ci==arr.length) | |
| { | |
| int [] occarr= new int[count]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Random; | |
| abstract class Compartment | |
| { | |
| public abstract String notice(); | |
| } | |
| class FirstClass extends Compartment | |
| { | |
| @Override |