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 tag: java beginner
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
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
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
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,
The Java language supports three types of comments in code to explain the business logic in code, to explain the algorithm logic to other developers in code itself or to generate the document content in coding itself. Single line comments : //…………………. Multi line comments : /* ………………. */ Documentation comments /** Document Content */
Earlier we discussed on method overloading, it gives same method name and differ by method signature. If we are not sure about number of argument(but same type) for the method, we can’t write one method of each combination of argument list. Code quality recommends maximum 4 overloaded method(with same name) for easy to use and
A constructor in Java is a block of code similar to a method that’s called when an instance of an object is created. Constructors are used to initialize the object’s state. Like methods, a constructor also contains collection of statements that are executed at time of Object
Variables are used to store data in java run-time. Methods are used to process access and manipulate the variables. Methods are primary building block in enterprise application as it holds the business logic of an enterprise. Each object in java talks with other objects by invoking methods. Good programmers write in a modular fashion which