In previous blog, we discussed on String and string constant pool. It highlighted the issue in String manipulation and how it fill the pool memory. We not recommended to use String for temporary string statement formation, logger statement, updatable string values, large file I/O stream of input processing. We can process these operation using String
Browsing category Java
Manipulation of String (Sequence of characters) is most important aspect of programming language. Name, id, address, role and username all manipulated as String in programming world. Java is no different from other language while using the String. In Java, String is sequence of characters and handled to make efficient use of memory. Strings are managed
In the previous post, we discussed on inner class for “one and only for” relationship among the classes. But static nested class not for same purpose, it is to add namespace to the class. It can be instantiated just with top class name (without top class instance). Static nested class is class scoped within another.
Before start discussion on inner class, let us discuss simple analogy. Boat and Fin(Flipper). Fin exists only for boat an to help boat to move in river. Fin would not be useful if there is no boat. But Fin is not a boat or not an part of boat. But it shares special relationship “one
Java coding practices recommended that maximum 80 characters in single line of the code. It is best for readability and understand the code. If our class require static members in more than 20 lines of our code and all lines are more than 80 characters in length, static import would help us to reduce the
Recently I had chance to meet my college junior, he said he started learning Java. I appreciated him for learning new programming skill. He is from C programming background, he said it is easy to learn java and he said java looks same like “C programming”. I was shocked. How he claims “Java programming same
Java methods accept parameters, execute business logic and return results. We can pass multiple argument to the methods and it return only one value from the methods. Some real time scenario, we may require to get more than one return values from single method. To get two return value from an method, one return value
Java encourages use of OOPS features such as inheritance and encapsulation. But in special cases, we want to restrict the change of our class or method or member variables or local variables. Here “final” keyword helps to mark the element initialized only once or design once and mark as complete. It is not allowed to
In the previous post, we discussed on creating the copy of object by clone() method. But one of main shortcome in the clone method is assigning value to final variables. Final variables can be assigned in declaration or in constructors. So your class has final members and copy of object required, it can’t be achieved
Previous post, we discussed on intention to create copy of object in java. In this post,we would discuss on different implementation of object copying. Before discuss on implementation, let us discuss on basic rule of clone copy implementation. 1) Copy of object and actual object should not refer at same object. If it is same,









