The program in JAVA:

[PHP]import java.util.Scanner;

public class Primes {

public static void main (String[]args){

Scanner input=new Scanner(System.in);

System.out.print("Enter two numbers");

int num1=input.nextInt();

int num2=input.nextInt();

Boolean isPrime=true;

for(int i=num1; i<num2; i++){

for(int j=2; j<=(int)Math.sqrt(i) && isPrime; j++){

if(i%j==0)

isPrime=false;}

if(isPrime==true)

System.out.print(i);

isPrime=true;

}

}

}

[/PHP]