Saturday, 20 December 2014

How Hashmap works internally in java

This page has been moved to our new blog http://www.javainhouse.com/2016/05/hashmap-internal-working-java.htm...
Read More »

Wednesday, 10 December 2014

Difference between equals() and ==

Difference between equals() and == Difference between equals() and == Hi all , these days i\'m about to write a post on very fashionable interview question that is what\'s the difference between equals and == .It is asked in every object familiarised language interview whether or not its Java or ASP.NET...
Read More »

Sunday, 7 December 2014

How to create custom Exception in Java

How to create custom Exception in Java Custom Exception Why we need custom Exception ? How to create a custom exception ? Write code to create a Custom Exception All these are questions usually asked in a Java interview .So my today's post on how to create a custom exception in java . As we know...
Read More »

Sunday, 30 November 2014

What is design pattern in java?

design pattern in java Design Pattern  : Design pattern are  answer to common occurring problem in software system development . Design pattern are language independent solution that are developed to solve common object oriented issues . They if used sensibly helps to extend code maintainability...
Read More »

Count the Number of Vowels in Java String

import java.util.Scanner; public class SB { public static void main(String[] args) { { String test=null; int j=0;    char index[]={'a','e','i','o','u'}; System.out.println("Enter the string"); test= new Scanner(System.in).nextLine(); for (int i = 0;...
Read More »

find the substring count from a string without string functions in java

import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Scanner; import java.util.Set; public class SB { public static void main(String[] args) { { String test=null; String index=null; int j=0; System.out.println("Enter the string"); ...
Read More »

Program to remove a particular character from a sentence

public class SB { public static void main(String[] args) { { String test=null; char remove = 0; System.out.println("Enter the String"); test = new Scanner(System.in).nextLine(); System.out.println("Enter the Character to be removed"); remove=new Scanner(System.in).nextLine().charAt(0); ...
Read More »

Saturday, 29 November 2014

Program to find a prime number in java

import java.util.Scanner; public class SB { public static void main(String[] args) { System.out.println("Enter the limit uptoo which you want to print prime no."); int in = new Scanner(System.in).nextInt(); int limit =in; for (int i = 2; i <=limit; i++) {  For further...
Read More »

Thursday, 27 November 2014

Count no.of times a word repeats in String in Java

public class SB { public static void main(String[] args) { String test="Hi I am here am am too good am very a m"; String find="am"; int i=0; String a[]=test.split(" "); for (int j = 0; j < a.length; j++) { if(a[j].equals(find)) { i++; } } System.out.println(i); ...
Read More »

Program in java to find a String in a sentence

Hi all I am writing a program to find whether a particular word exists in a sentence or not . public class SB { public static void main(String[] args) { String test="Hi I am here"; String find="am"; if(test.indexOf(find)>0) { System.out.println("found "); } else ...
Read More »

Tuesday, 25 November 2014

Top Java Collections interview Questions

1.What is Java Collection Framework? Ans : Java Collections Framework is also known as JCF. It is a set of classes and Interfaces that implement commonly used data structures like List ,Linked List etc. 2. Explain Collection Framework in detail or what all collections are present in Java Collection...
Read More »

Monday, 24 November 2014

Java Interview Questions

Q1. How can you get to know that whether one object belongs to a particular class ? Ans : using instanceof The instanceof operator tests whether an object has in its prototype chain theprototype property of a constructor. Eg : We have a class test with a object Test...
Read More »

Sunday, 23 November 2014

Life cycle of a thread in java

Life cycle of a thread in java Life cycle of a thread contains following stages : New Runnable Running Blocked or Non running Terminated  Release 5.0 introduced the Thread.getState method. When called on a thread, one of the following Thread.State values is returned: NEW RUNNABLE BLOCKED WAITING TIMED_WAITING TERMINATED New...
Read More »

Friday, 21 November 2014

Java Programs for interview

1. Program to reverse a String in Java . 2. Program to print Fibonacci series in java. 3.Program to print Fibonacci series in java using recursive method . 4.Program in java to find a String in a sentence. 5. Program to count no.of times a word repeats in String in Java 6. Program to find Prime...
Read More »

Program in Java To print Fibonacci series using recursive method

( function() { if (window.CHITIKA === undefined) { window.CHITIKA = { 'units' : [] }; }; var unit = {"calltype":"async[2]","publisher":"Harneetkaur","width":550,"height":250,"sid":"Chitika Default"}; var placement_id = window.CHITIKA.units.length; window.CHITIKA.units.push(unit); ...
Read More »

Program in Java To print Fibonacci series

Hi all , Today I am going to write a post on popular interview program which is Write a program in java to print Fibonacci series . So what is Fibonacci series In mathematics, the Fibonacci numbers or Fibonacci sequence are the numbers in the following integer sequence:...
Read More »