thewisecrab
AFK
Hi all.
Since my earlier posts here, I can say that I'm a bit more comfortable with Java now. ie, I can atleast write a few programs without help from friends/teachers.
I'm studying Java as it's in my syllabus, not to be a programmer, but even so, that's going well.
Anyway (back to the point), suppose this is a pretty rudimentary program
Is there anyway I run it as an app on a Java ready phone? like on s40 series of Nokia or Moto?
I dont want to view the .java file (ReadManiac can do that) but I want to actually run the program (ie. accept values from user in runtime and display output)
So, is there any way?
Since my earlier posts here, I can say that I'm a bit more comfortable with Java now. ie, I can atleast write a few programs without help from friends/teachers.
I'm studying Java as it's in my syllabus, not to be a programmer, but even so, that's going well.
Anyway (back to the point), suppose this is a pretty rudimentary program
Code:
import java.io.*;
public class TwinPrime
{
public static void main(String args[])throws IOException
{
int a=1,b,i,j,n,flag;
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
System.out.println("Enter a value:");
n=Integer.parseInt(br.readLine());
for(i=2;i<=n;i++)
{
flag=0;
for(j=2;j<=i/2;j++)
{
if(i%j==0)
{
flag=1;
break;
}
}
if(flag==0)
{
b=i;
if(b-a==2)
System.out.println("The twin numbers are:"+a+" "+b+" ");
a=b;
}
}
}
}
Is there anyway I run it as an app on a Java ready phone? like on s40 series of Nokia or Moto?
I dont want to view the .java file (ReadManiac can do that) but I want to actually run the program (ie. accept values from user in runtime and display output)
So, is there any way?