Welcome to the JavaCracker.com. This website helps you to learn java and you will be become a leader in java

To restrict a java class from creating multiple objects We can restrict our java class for creating specified number of objects of it and it’s very easy. Before going to this topic I want to share some knowledge on singleton class. A singleton class is a class which always returns a single object at any time of application life cycle. To create a singleton class, we need to follow the [...]

Continue

Create a JMS client using CCDT URL In my on job learning I have leant and written a java code to establish a connectivity using CCDT(Client Channel Definition Table) url. I just share my real time experience with you. It may help you to resolve your problems. Before going to give the example let me discuss about CCDT. The Client Channel Definition Table (CCDT) is used to determine client channel [...]

Continue

Convert image to String and String to image I am working in a project where I implemented a module which can convert an image to string and vice versa. So I just thought to post it here. Here I am using apache commons codec API (apache commons codec 1.8.jar ). You can download it from apache web site “http://commons.apache.org/proper/commons-codec/download_codec.cgi” Here is the example below: 1. ImageEncoderAndDecoder.java  Java |  copy code |? 0102 03package com.meditrade.image;04 05import org.apache.commons.codec.binary.Base64;06 07/**08 * @author [...]

Continue

Create JMS Client for IBM MQ with example Before going to the example let me tell you about JMS. JMS stands for Java Message Service API that allows java application to communicate with any messaging implementation by sending, and consuming messages. Also you can create a message using this API. I am giving an example of JMS client for IBM MQ. You can use JMS API provided by Sun or [...]

Continue

Configure Data Source in JBoss-AS 5.2 for MS SQL Server 2012 Database Before going to create JNDI Datasource let me tell you about “What is datasource ?” The Datasource is a Java naming and Directory Interface(JNDI) object which contains the connection object from the connection pool to database. In order to create Datasource file you need to follow the naming convention. For example the name of the datasource file is [...]

Continue

Why String is immutable in java? There are several reasons why the String object is immutable in java. 1. Security Issue: Imagine String object isn’t immutable and you need to open a secure file to authenticate the users. Let’s assume that two users User1 and User2 are going to log in and they have their own password file “Password1” and “Password2” respectively. Now user1 logged in into the system and [...]

Continue

Different ways to reverse a String in java Here is an example to reverse a String. I have implemented seven ways in this example  Java |  copy code |? 001002 003import java.util.Stack;004 005/**006 * TODO add description007 * 008 * @author Kaushik.Jana009 * @version 1.0010 */011 012public class ReverseString013{014 015 016 //Reversing string using StringBuffer017 018 public static String reverseStringUsingStringBuffer(String str)019 {020 021 return new StringBuffer(str).reverse().toString();022 }023 024 // Reversing string using recursion 025 026 public static String reverseStringUsingRecursion(String str)027 {028 String leftStr = "";029 String rightStr = "";030 [...]

Continue

1. What is Exception?         Exception is an event (abnormal behaviour) of a program which occurs during the execution of the program. In a result, the program will be terminated. E.g. –  Division operation by zero Try to open a file which is not available or accessible. Perform some operation with null value 2. What happens if exception occurred?         If exception occurs during [...]

Continue

Immutable Object: Object is created once and value of the object can’t be changed. To create an immutable object, we need to follow some rules: 1. The class should be marked as final. So, it can’t be extended from other class. 2. The instance variables are final and private. 3. There is no setter method for the instance variable. 4. Only getter method can be provided. 5. There should not [...]

Continue

StringBuffer: A thread-safe, mutable sequence of characters. A string buffer is like a String, but can be modified. At any point in time it contains some particular sequence of characters, but the length and content of the sequence can be changed through certain method calls. String buffers are safe for use by multiple threads. The methods are synchronized where necessary so that all the operations on any particular instance behave as [...]

Continue

To restrict a java c

To restrict a java class from creating multiple objects We [...]

Create a JMS client

Create a JMS client using CCDT URL In my on [...]

Convert image to Str

Convert image to String and String to image I am [...]

Create JMS Client fo

Create JMS Client for IBM MQ with example Before going [...]

Configure JNDI Data

Configure Data Source in JBoss-AS 5.2 for MS SQL Server [...]

Create a JMS client

Create a JMS client using CCDT URL In my on [...]

Create JMS Client fo

Create JMS Client for IBM MQ with example Before going [...]

Sponsors

  • Cheap reliable web hosting from WebHostingHub.com.
  • Domain name search and availability check by PCNames.com.
  • Website and logo design contests at DesignContest.com.
  • Reviews of the best cheap web hosting providers at WebHostingRating.com.