Question d’entretien chez Oracle

String,String buffer,String builder difference. Can u write your own immutable class n how? hashmap implementation and hashcode(),equals() method he asked me to write 2 logical testing programs with reduced complexity( 0,1,1,2,4,5,3,3,1,0,1 traverse once only n get the duplicate number's along with the count). printing pascal triangle duplicate letter from a string with less complexity reversing words of string individually(this is a tree---o/p: siht si a eert)

Réponses aux questions d'entretien

Utilisateur anonyme

22 févr. 2016

/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { public static void main (String[] args) throws java.lang.Exception { int i = 0, j = 0, k = 0, depth = 4; ArrayList al = new ArrayList(); ArrayList aln = new ArrayList(); al.add(1); aln = (ArrayList) al.clone(); for(i=0; i < depth; i++){ for(j=0; j

8

Utilisateur anonyme

24 août 2018

public class StringWordsReverse { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub String TestString = "Lets play Cricket"; String s[]=TestString.split(" "); StringBuffer s1; for(int i=0;i

5

Utilisateur anonyme

28 juin 2016

import java.util.StringTokenizer; /** * reversing words of string individually * */ public class StringWordsINdividuallyReverse { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub String TestString = "Lets play Cricket"; StringTokenizer strToken = new StringTokenizer(TestString," "); for(int i=1;strToken.hasMoreTokens();i++){ System.out.println(i +"is :" + new StringBuffer(strToken.nextToken()).reverse()+"\n"); //System.out.println(strToken.nextToken()+"\n"); } } }

Utilisateur anonyme

24 août 2018

public class StringWordsINdividuallyReverse { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub String TestString = "Lets play Cricket"; String s[]=TestString.split(" "); StringBuffer s1; for(int i=0;i

3