You are on page 1of 4

Abhishek Kandel(19BCE2629)

Code:

import java.util.*;

import java.io.*;

class Arr{

public static int[] copyOf(int[] array){

int b[]=new int[array.length];

for(int i=0;i<array.length;i++){

b[i]=array[i];

return b;

public static int[] copyOf(int[] array, int newLength){

int[] c=new int[newLength];

while(array.length!=newLength){
if(array.length>newLength){

for(int i=0;i<newLength;i++){

c[i]=array[i];

if (array.length<newLength){

c[array.length-1]=0;

return c;

public class Main{

public static void main(String[] args){

Arr a=new Arr();

int arr[]={11,12,13,14,15};

System.out.println(Arr.copyOf(arr));

System.out.println(Arr.copyOf(arr,3));

System.out.println(Arr.copyOf(arr,7));

}
Code:

import java.util.*;

class prmgrp{

String program;

String degree;

int btechnum=mtechnum=0;

prmgrp(String p){

program=p;

class programspecial extends prmgrp{

if(program.charAt(0)=='B'){

degree="B.Tech";

btechnum++;

}else{

degree="M.Tech";

mtechnum++;

}
class Main{

public static void main(String[] args){

Scanner s=new Scanner(System.in);

programspecial[] ps=new programspecial[3]

for(int i=0;i<e;i++){

ps[i]=programspecial(s.next());

System.out.println("the number of programs offered for btech is :"+btechnum);

System.out.println("the number of programs offered for mtech is :"+mtechnum);

You might also like