Skip to main content

Posts

Showing posts with the label java

What is UUID ? and Where its used ?

This article is regarding UUID and where it is used. The UUID is generated using a cryptographically strong pseudo random number generator. It is belongs to the package java.util. It is used to generate random number which is stronger and there wont be any  repetition of number.  UUID can be used for Creating random file names, Maintaining different Session id in web application. Transaction id in Banking sector. Primary key in Database. public static void man(String[] args) { UUID uniqueId = UUID . randomUUID ( ) ; System . out . println ( "The unique id is" + uniqueId . toString ( ) ) ; }

What is the difference between Abstraction and Encapsulation?

I'm sure You came here to see the answer after vising plenty of websites and which is not enough to understand about that concept. The reason why you cant get the perfect or believable answer abut this concept is you're not reading the whole content slowly and carefully. But im sure if you read this fully and carefully, you can earn the knowledge about the difference between Abstraction and Encapsulation. and here we are gonna teach you the real time scenario of Abstraction and Encapsulation. ok!  Lets go to the Topic. What is Abstraction: "Abstraction  is a process of hiding the implementation details and showing only functionality to the user." You could see this answer in many websites. Let me explain about what is implementation and functionality.  For Example, " Dhoni is a cool captain" Cool is his nature it is his Function. He is always cool even the Team is in underpressure. So cool is his Natural Function. And, We dont know how he is so cool in under

Standardization of Method Signature

Today i would like to convey some of standards which most of it companies follows. Method signature which is not suppose to get changed when ever each parameter of a method is removed or added. If so we have to change all the code which uses this method. So its better to pass HashMap instead of passing each and every parameter. Example: public void addUser(int empid,String passcode,String addressStandardization of Method Signature,int mobileNumber) Consider addUser method is used to process user data. In future if we want to add some parameter to addUser method we need to change all the code which uses the method addUser so it is better to send HashMap instead of sending all data seperately HashMap hm = new HashMap() ; hm.put("empid","id") ; hm.put("passcode","***") ; hm.put("address","____") ; hm.put("mobileNumber","000000000") ; public void addUser(HashMap data) { int id = Integer . parseInt ( data .

JAVA INTERVIEW QUESTIONS

JAVA INTERVIEW QUESTIONS 1.       What will be the result of attempting to compile and run the following class? public class Assignment {     public static void main(String[] args) {         int a, b, c;         b = 10;         a = b = c = 20;         System.out.println(a);     } } The code will fail to compile, since the compiler will recognize that the variable c in the assignment statement a = b = c = 20; has not been initialized. The code will fail to compile because the assignment statement a = b = c = 20; is illegal. The code will compile correctly and will display 10 when run. The code will compile correctly and will display 20 when run. 2.       Which statements are true? a.       The result of the expression (1 + 2 + "3") would be the string "33" . b.       The result of the expression ("1" + 2 + 3) would be the string "15" . c.        The result of the expressi