Hi,
I'm trying to create an array for converting Octal number from input to Binary later...print out for table look-up. Please help!

import java.util.*; // Scanner class
public class check1
{

	public static void main(String [] args)
	{

		int i;
		String biArray[]={"000", "001", "010", "011", "100", "101", "110", "111"};
		
		for(i=0; i<biArray.length; i++)
		{
			Scanner input= new Scanner(System.in);
			System.out.println("Enter the Octal number: ");
			int OctNum=input.nextInt();
			
			biArray[i]= Interger.parseInt(OctNum);
		}
		for(i=0; i<biArray.length; i++)
			System.out.println("Octal number of "+i+"is "+biArray[i]+"in binary");
	}

}

After compiled , this is what I have
check1.java:17: cannot find symbol
symbol : variable Interger
location: class check1
biArray= Interger.parseInt(OctNum);
^
1 error

There's only one r in Integer

Opps...
So I fixed it.
Still have this problem in the same line.

symbol : method parseInt(int)
location: class java.lang.Integer
biArray= Integer.parseInt(OctNum);
^
1 error


Do I use it right for the scanner class. And if not, what is your suggestion?

Think about it...
what kind of variable does parseInt return?
what kind of variable is biArray?

ps when you have an error post the full text of the error message.

They're both integers.
How do I convert the input Octal to Binary by pulling out from the array biArray[]={"000", "001", "010", "011", "100", "101", "110", "111"}; ?

They're both integers.

Your code says
String biArray[] ...
so how do you think biArray can be an integer?

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.