Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Everett James   on Jun 06 In Java Category.

  
Question Answered By: Jean Bell   on Jun 06

I dont know what the exact problem is but using bufferedReaders
instead of System.in.read() and conversion to int  made your program
execute correctly.

import java.io.*;
public class  first {
public static  void main(String args[]) throws  java.io.IOException
{
int i=0, j=0;
BufferedReader stdin=new BufferedReader(new
InputStreamReader(System.in));
int a[][]= new int[4][4];
for ( i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
System.out.print("enter:");
a[i][j]=
Integer.parseInt(stdin.readLine());

}

}
System.out.println(" the a[0][0] = " + a[0][0] );
System.out.println(" the a[1][1] = " + a[1][1] );
}
}

Share: