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

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?

Edited 5 Years Ago by tracydo: n/a

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.

Edited 5 Years Ago by JamesCherrill: n/a

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"}; ?

This article has been dead for over six months. Start a new discussion instead.