Program to demonstrate how to create Composite Primary Keys by @Embeddable annotation in Hibernate using JPA.  
Click here to download complete source code
Click here to download complete source code
@Deprecated
public class Calculator {
 
 @Deprecated
 public int sum(int x , int y){
  return x + y;
 }
 
 public int sum(int ... numbers) {
  int sum = 0;
  for(int number : numbers) {
   sum = sum + number;
  }
  return sum;
 }
 
 public static void main(String [] args) { 
  Calculator calculator = new Calculator();
  int result = calculator.sum(5, 10);
  System.out.println("The sum is : " + result);
  
  result = calculator.sum(5, 5, 10, 15);
  System.out.println("The sum is : " + result);
  
 }
 
}
/** 
 * This class demonstrate usage of javadoc comments.
 * 
 * @author Jonty.
 */
public class JavadocDemo {
	/**
	 *  
	 * @param number1 first int value
	 * @param number2 second int value
	 * @return sum of number1 and number2
	 * @throws no exception
	 */
	public int sum(int number1 , int number2) {
		return number1 + number2;
	}
}
import java.util.Map;
import java.util.Scanner;
public class EnvironmentVariables {
 public static void main(String[] args) {
  
  Scanner scanner = new Scanner(System.in);
  
  System.out.print("Enter the name of Environment Variables : ");
  
  String name = scanner.nextLine();
  
  String value = System.getenv(name);
  
  System.out.println(name + " = " + value);
  
  Map < String , String > mapOfEnvironmentVariables = System.getenv();
  
  for(String var : mapOfEnvironmentVariables.keySet()) { 
   
   System.out.println(var + " = " + System.getenv(var));
   
  }  
 }
}
public class CommandLineArguments {
 public static void main(String[] args) {
  
  System.out.print(args[0] + " ");
  
  System.out.print(args[1]);
  
 }
}
import java.io.File;
import java.io.IOException;
public class CreateFile {
 public static void main(String[] args) {
  
  File file = new File("test.txt");
  
  try {
  
  if(file.createNewFile()) { 
   System.out.println("File successfully created.");
  } else {
   System.out.println("File already exists.");
  }
  
  } catch(IOException ioe) { 
   System.out.println("IO Exception occured.");
  }
 }
}