0
import java.io.*;
import java.util.Scanner;
class heh
{public static void main(String[]args)throws Exception
{
	BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
	Scanner me =new Scanner(System.in);
	int a[]= new int[20];
	boolean find = false;
	int b;
	int c;
	System.out.println("Enter 20 numbers:");
	String read=input.readLine();
	String token[]=read.split(" ");
	for (b=0; b<20;b++)
	{a[b]=Integer.parseInt(token[b]);}
	System.out.println("Enter No. u want 2 Search ^^");
	c=me.nextInt();
	for(b=0; b<20; b++)
	{if(a[b]==c)
	{ find=true;
	   break;
	}}
	if(find)
	{System.out.println("Found "+c);
	for(int d=0; d<20; d++)
	{if(a[d]!=c)
	System.out.print(" "+a[d]);
	}System.out.println();
	}
	else
	System.out.println("Search not found");
}
}

this is an example of my program that i want to do again....that it uses that .split in order to enter 20 numbers in one line.....but my problem is i want to do it in two dimensional array [7][7]; using the .split method....pls.. help me to input numbers using .split in two dimensional array...thx a lot guys....this is just an programming exercises that i want to solve and i guess i don't have a clue in inputting numbers in two dimensional array using .split....thx

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by web4
0

umm could you give me the code?? on how to make a two dimensional array that uses .split just like in my first program....thx...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.