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

Recommended Answers

All 2 Replies

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...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.