1. Swap two numbers. Given number a=10, b=20. Expected output a=20, b=10. --logic 1: create a temprory variable --logic 2: using plus and minus a=a+b; b=a-b; a=a-b; --logic 3: multiplication and division operator, only when a and b are non zero a=a*b; b=a/b; a=a/b; Note: what is XOR operator 2. Reverse a given number. Given number is 1234. Expected output 4321 or reverse a number using stirng buffer and string builder class Note: What is scanner class in java? How to take input from scanner class in java Note: What is difference between modulo % division and division / Note: Revise java String class and its method 3. reverese a given string Note: what is charAt() method Note: what is toCharArray() method 4. how to check number is palindrome or not// use the logic used in question 2 hint: revers the number and compare with original number 5. how to check string is palindrome or not// use the logic used in question 3 hint: reverse the string and compare with original string....
core java interview questions: 1. what is difference between callable and runnable- revise multi threading- DISCUSS to return anything from thread we use callable, whatever we want to return 2. what is bloking queue 3. how to stop hashing collision-revise collection framework- DISCUSS hashing collision: 4. what is load factor of hashmap- 0.75f (75% of the map size). 5. what is default size of hashmap-16 6. what is builder design pattern- revise design pattern- DISCUSS It is used to construct a complex object step by step and the final step will return the object. Consider the construction of a home. Home is the final end product (object) that is to be returned as the output of the construction process. It will have many steps like basement construction, wall construction, and so on roof construction. Finally, the whole home object is returned. Here using the same process you can build houses with different properties. 7. how to create immutable class- revis...
Reference link: youtube.com/watch?v=oNdMigiwzlU&t=227s- java 8 programming questions https://www.youtube.com/watchv=QRwG9X9l6xI&list=PLsyeobzWxl7qbvNnJKjYbkTLn2w3eRy1Q- -----------what is lamda expression/how to write lamda expression exampl1: ()->{SOPL("Hello")}--curly braces is optional when one line is written example 2: (a,b)->{sopl(a+b)}---compiler can guess the data type example: 3 n->n*n--when only one input parameter then parenthesis is optional, and return is not required if you are not using curly braces. example : 4 s-> s.length; -----------------------calling the lamda function/Functional Interface-------------------------- what is lamda expression : lamda expression is nothing but anonymous function -no name - no modifier - no return type - special arrow symbol how to write lamda expression what is the functional interface n->return n*n; ---invalid n->{return n*n;};----valid n-> {return n*n};----invalid n->{n*n;};------inval...
Comments
Post a Comment