Powered by Blogger.
Showing posts with label Util pack. Show all posts
Showing posts with label Util pack. Show all posts

Best practice to find Duplicate Character from a String in java

>> Sunday, June 28, 2015

This program could be the best way to find the number of duplicate characters from the given String. Here we are using Map and Set from java.util.Collections package. In the below program we are using Set to collect different characters from the given String. One boolean variable and one method named as findDuplicateChar(String myString) to find the duplicates. Also some known methods like toCharArray() to convert String to character array and for-each loop to iterate Set and Array. Better you can go through the given program to find duplicate characters from the given String.
Find duplicate characters program_JavabynataraJ

Read more..

Program to Convert Decimal to Octal,Hexa and Binary values

>> Saturday, October 18, 2014

Binary, Hexa and Octal are the number formats to use in different mathematical calculations. In our real life we use numbers with decimals. It may be integer value or float value both are called as decimals. Let us know the number format examples given below:
Decimal format : A representation of a real number using the base ten and decimal notation.
program to convert decimal to octa-hexa-binary_JavabynataraJ

Read more..

java.util.HashMap in detail with a program

>> Friday, September 12, 2014

HashMap is a class from java.util package and extends AbstractMap, implements Map,Cloneable and Serializable interfaces. HashMap contains Key,Value parameters we can denote it as HashMap<Key,Value> or HashMap<k,v>.Map allows only one null key and many null values and all the methods in HashMap are not synchronized. HashMap is an unordered collection , means the keys and values will not maintain insertion order.
An instance of HashMap has two parameters that affect its performance: initial capacity and load factor.
Let us know the terminology used in HashMap.

Read more..

What is Reflection and How it Works in Java

>> Monday, September 23, 2013

Reflection is the process of obtaining runtime information about the class or interface.”
Reflection in Java
Runtime information is nothing but deal with the following:
  1. Finding the name of the class or interface. 
  2.  Finding the data members of the class or interface. 
  3. Finding number of constructors (default constructor and number of parameterized constructors).
  4. Number of instance methods.
  5. Number of static methods. 
  6. Determining modifiers of the class (modifiers of the class can be public, final, public + final,abstract and public + abstract).
  7. Obtaining super class of a derived class. 
  8. Obtaining the interfaces which are implemented by various classes.

Read more..

Display Current Date using GenericServlet

>> Sunday, August 26, 2012

We have a class named Date from java.util.Date package. We can use the Date class methods to display the date. We are going to display this date in the webpage using servlets.

Here we are using init methods to initialize the names and values. with this we can get the names and values from the web.xml file while the program runs. Actually this init(javax.servlet.ServletConfig) method is invoked by the container during initialization phase of the servlet interface.

init() method is a convienience method provided in javax.servlet.GenericServlet class. Generally, it is suggested that init(javax.servlet.ServletConfig) method present in javax.servlet.GenericServlet class should be given a chance to get executed, during servlet's initialization. This method, apart from performing some initialization process, invokes init() method at the end.

Read more..

Related Posts Plugin for WordPress, Blogger...
© javabynataraj.blogspot.com from 2009 - 2022. All rights reserved.