Tags » Java 2

A Stylish Transport Pattern

Although intended as a mid-century rail travel pattern, this particular design has a wide and diverse range of possibilities.

Unfortunately an injury to my arm has meant a return to work that I did some 10 years ago creating designs and patterns using Java programming and the Processing toolkit. 123 more words


Java program for linear search – Example

1.This program uses linear search algorithm to find out a number among all other numbers entered by user.

/* Program: Linear Search Example
 * Written :  from hariprasanthmadhavan.wordpress.com
 * Input: Number of elements, element's values, value to be searched
 * Output:Position of the number input by user among other numbers*/
import java.util.Scanner;
class LinearSearchExample
   public static void main(String args[])
      int counter, num, item, array[];
      //To capture user input
      Scanner input = new Scanner(System.in);
      System.out.println("Enter number of elements:");
      num = input.nextInt(); 
      //Creating array to store the all the numbers
      array = new int; 
      System.out.println("Enter " + num + " integers");
      //Loop to store each numbers in array
      for (counter = 0; counter < num; counter++)
        array = input.nextInt();

      System.out.println("Enter the search value:");
      item = input.nextInt();

      for (counter = 0; counter < num; counter++)
         if (array == item) 
           System.out.println(item+" is present at location "+(counter+1));
           /*Item is found so to stop the search and to come out of the 
            * loop use break statement.*/
      if (counter == num)
        System.out.println(item + " doesn't exist in array.");
} 33 more words

java program to check palindrome string using recursion

Program: Check whether String is palindrome using recursion

package beginnersbook.com;
import java.util.Scanner;
class PalindromeCheck
    //My Method to check
    public static boolean isPal(String s)
    {   // if length is 0 or 1 then String is palindrome
        if(s.length() == 0 || s.length() == 1)
            return true; 
        if(s.charAt(0) == s.charAt(s.length()-1))
        /* check for first and last char of String:
         * if they are same then do the same thing for a substring
         * with first and last char removed. 122 more words

java program to find factorial of a given number using recursion

1.Program will prompt user for the input number. Once user provide the input, the program will calculate the factorial for the provided input number.

 * @author: hariprasanthmadhavan.wordpress.com
 * @description: User would enter the 10 elements
 * and the program will store them into an array and 
 * will display the sum of them. 152 more words

How to bootstrap Hibernate without the persistence.xml file

Follow @vlad_mihalcea


JPA relies heavily on the persistence.xml configuration file, and the standard API to bootstrap a JPA provider programmatically requires too much boilerplate code. 437 more words


OOPs Interview Questions

1. What is OOPS?

OOPS is abbreviated as Object Oriented Programming system in which programs are considered as a collection of objects. Each object is nothing but an instance of a class. 1,957 more words

High-Performance Java Persistence – Chapter 9 – Hibernate Connection Management

Follow @vlad_mihalcea

Part 2, Chapter 9

Every new chapter of my book is released right after it’s being completed, so the reader doesn’t have to wait for the whole part to be finished to get access to new material. 292 more words