oCreate the remote interface.oProvide the implementation of the remote interface.oCompile the implementation class and create the stub and skeleton objects usingthe rmic tool.oStart the registry service by the rmiregistry tool.oCreate and start the remote application.oCreate and start the client application.245) What is the use of HTTP-tunneling in RMI?HTTP tunneling can be defined as the method which doesn't need any setup to workwithin the firewall environment. It handles the HTTP connections through the proxyservers. However, it does not allow outbound TCP connections.
246) What is JRMP?JRMP (Java Remote Method Protocol) can be defined as the Java-specific, stream-basedprotocol which looks up and refers to the remote objects. It requires both client andserver to use Java objects. It is wire level protocol which runs under RMI and over TCP/IP.247) Can RMI and CORBA based applications interact?Yes, they can. RMI is available with IIOP as the transport protocol instead of JRMP.Core Java: Data Structure interview questions248) How to perform Bubble Sort in Java?Consider the following program to perform Bubble sort in Java.1.publicclassBubbleSort {2.publicstaticvoidmain(String[] args) {3.int[] a = {10,9,7,101,23,44,12,78,34,23};4.for(inti=0;i<10;i++)5.{6.for(intj=0;j<10;j++)7.{8.if(a[i]<a[j])9.{10.inttemp = a[i];11.a[i]=a[j];12.a[j] = temp;13.}14.}15.}16.System.out.println("Printing Sorted List ...");17.for(inti=0;i<10;i++)18.{19.System.out.println(a[i]);20.}21.}22.}
Output:Printing Sorted List . . .7910122334344478101249) How to perform Binary Search in Java?Consider the following program to perform the binary search in Java.1.importjava.util.*;2.publicclassBinarySearch {3.publicstaticvoidmain(String[] args) {4.int[] arr = {16,19,20,23,45,56,78,90,96,100};5.intitem, location = -1;6.System.out.println("Enter the item which you want to search");7.Scanner sc =newScanner(System.in);8.item = sc.nextInt();9.location = binarySearch(arr,0,9,item);10.if(location != -1)11.System.out.println("the location of the item is "+location);12.else13.System.out.println("Item not found");14.}15.publicstaticintbinarySearch(int[] a,intbeg,intend,intitem)16.{17.intmid;18.if(end >= beg)19.{20.mid = (beg + end)/2;21.if(a[mid] == item)22.{23.returnmid+1;24.}25.elseif(a[mid] < item)26.{27.returnbinarySearch(a,mid+1,end,item);28.}29.else
30.{31.returnbinarySearch(a,beg,mid-1,item);32.}33.}34.return-1;35.}36.}Output:Enter the item which you want to search45the location of the item is 5250) How to perform Selection Sort in Java?Consider the following program to perform selection sort in Java.1.publicclassSelectionSort {2.publicstaticvoidmain(String[] args) {3.int[] a = {10,9,7,101,23,44,12,78,34,23};4.inti,j,k,pos,temp;5.for(i=0;i<10;i++)6.{7.pos = smallest(a,10,i);8.temp = a[i];9.a[i]=a[pos];10.a[pos] = temp;11.}12.System.out.println("\nprinting sorted elements...\n");13.for(i=0;i<10;i++)14.{15.System.out.println(a[i]);16.}17.}18.publicstaticintsmallest(inta[],intn,inti)19.{20.intsmall,pos,j;21.small = a[i];22.pos = i;23.for(j=i+1;j<10;j++)24.{25.if(a[j]<small)26.{27.small = a[j];
28.pos=j;29.}30.}31.returnpos;32.}33.}Output:printing sorted elements...
Upload your study docs or become a
Course Hero member to access this document
Upload your study docs or become a
Course Hero member to access this document
End of preview. Want to read all 157 pages?
Upload your study docs or become a
Course Hero member to access this document