Skip to content

Instantly share code, notes, and snippets.

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.
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.
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));
}
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));
import java.util.Scanner;
class Node {
int data;
Node next;
public Node(int data) {
this.data = data;
}
}
public class Linkedlist12 {
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");
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");
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
//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];
import java.util.Random;
abstract class Compartment
{
public abstract String notice();
}
class FirstClass extends Compartment
{
@Override