Why can't I use a double to point to a place in an array?
Sorry if this is a stupid question, but whenever I compile code like this I get this error message:
QuickTest.java:16: possible loss of precision
found: double
required: int
System.out.println(s[t]);
I would use an int, but My array that I want to use in other code is 1000 places big. What am I doing wrong?
publicclass QuickTest{
static String[] s =new String[200];
publicstaticvoid main (String[] args){
s[0] ="Why";
s[1] ="do";
s[2] ="you";
s[3] ="own";
s[4] ="ten";
s[5] ="Red";
s[6] ="white";
s[7] ="and";
s[8] ="blue";
s[9] ="hats";
double t = 2;
System.out.println(s[t]);
}
}

