Yet another not working thingy mabob

publicclass inttest{

publicstaticvoid main(String[] args)

{

int days;

days = 1000;

days();

}

publicstaticvoid days(){

System.out.println("There is now "+days+" left.");

}

}

All help appreciated with why this isn't working. By the way, this is the error: inttest.java:12: cannot find symbol

symbol : variable days

location:class inttest

System.out.println("There is now "+days+" left.");

^

1 error

Press any key tocontinue . . .

[1175 byte] By [Zacha] at [2007-11-27 2:24:23]
# 1

days is local to the main() method. Other methods can't see it. Read the section in this article about variable scope.

http://java.about.com/od/beginningjava/l/aa_vars1.htm

Both of these will work.

public class Test

{

int days;

public static void main(String args[])

{

days = 1000;

printDays();

}

public static void printDays()

{

System.out.println(days);

}

}

/* - */

public class Test

{

public static void main(String[] args)

{

int days = 1000;

printDays(days);

}

public static void printDays(int numDays)

{

System.out.println(numDays);

}

}

CaptainMorgan08a at 2007-7-12 2:31:21 > top of Java-index,Java Essentials,New To Java...
# 2
Umm, ok thanks. Anymore suggestions? Morgan, your first one did not work. Thanks though.
Zacha at 2007-7-12 2:31:21 > top of Java-index,Java Essentials,New To Java...
# 3

> days is local to the main() method. Other methods

> can't see it. Read the section in this article about

> variable scope.

>

> http://java.about.com/od/beginningjava/l/aa_vars1.htm

>

> Both of these will work.

> public class Test

> {

>int days;

>public static void main(String args[])

> {

>days = 1000;

> printDays();

>}

>public static void printDays()

> {

>System.out.println(days);

> }

>

> /* - */

>

> public class Test

> {

>public static void main(String[] args)

> {

>int days = 1000;

> printDays(days);

>}

>public static void printDays(int numDays)

> {

>System.out.println(numDays);

>

> }

For the first example, days needs to be made static, because you're accessing it from within static methods.

guitar_man_Fa at 2007-7-12 2:31:21 > top of Java-index,Java Essentials,New To Java...
# 4
> For the first example, days needs to be made static,> because you're accessing it from within static> methods.Yup, thanks for the correction. Trying to answer questions while watching 300 doesn't work so well. ;-)
CaptainMorgan08a at 2007-7-12 2:31:21 > top of Java-index,Java Essentials,New To Java...
# 5
Is 300 good? I want to see that.
Zacha at 2007-7-12 2:31:21 > top of Java-index,Java Essentials,New To Java...
# 6
> Is 300 good? I want to see that.It's probably the best movie I've ever seen.Did you read through that link I gave you?
CaptainMorgan08a at 2007-7-12 2:31:21 > top of Java-index,Java Essentials,New To Java...
# 7
Yes, and it wasn't helpful much...
Zacha at 2007-7-12 2:31:21 > top of Java-index,Java Essentials,New To Java...
# 8
> Yes, and it wasn't helpful much...That isn't helpful either.
prometheuzza at 2007-7-12 2:31:21 > top of Java-index,Java Essentials,New To Java...
# 9
> ...> questions while watching 300 doesn't work so well. ;-)You mean the South Park episode? http://www.southparkx.net/stream/episode-1106-stream
prometheuzza at 2007-7-12 2:31:21 > top of Java-index,Java Essentials,New To Java...
# 10
> > ...> > questions while watching 300 doesn't work so well.> ;-)> > You mean the South Park episode?> http://www.southparkx.net/stream/episode-1106-streamNo, 300 is a new Movie.
Zacha at 2007-7-12 2:31:21 > top of Java-index,Java Essentials,New To Java...
# 11
> You mean the South Park episode?No! It's a movie about the Spartans at the [url= http://en.wikipedia.org/wiki/Battle_of_thermopylae]Battle of Thermopylae[/url]. It didn't come out in the Netherlands?
CaptainMorgan08a at 2007-7-12 2:31:21 > top of Java-index,Java Essentials,New To Java...
# 12

> > You mean the South Park episode?

>

> No! It's a movie about the Spartans at the

> [url=http://en.wikipedia.org/wiki/Battle_of_thermopylae]Battle of Thermopylae[/url]. It didn't come out in

> the Netherlands?

Yes, it's out here as well. It was some sort of a joke, sorry.

; )

I must be honest: liked South Park's parody better than the trailer of [the movie] 300.

prometheuzza at 2007-7-12 2:31:21 > top of Java-index,Java Essentials,New To Java...
# 13
> > Is 300 good? I want to see that.> > It's probably the best movie I've ever seen.Better than Citizen Kane?
DrLaszloJamfa at 2007-7-12 2:31:21 > top of Java-index,Java Essentials,New To Java...
# 14

> Yes, it's out here as well. It was some sort of a

> joke, sorry.

That's where sarcasm tags come in. ;-)

> I must be honest: liked South Park's parody better

> than the trailer of [the movie] 300.

I have to be honest, I'm not a huge South Park fan. I prefer The Family Guy over South Park. You should really see 300 when it comes out on dvd (or blu-ray!).

CaptainMorgan08a at 2007-7-12 2:31:21 > top of Java-index,Java Essentials,New To Java...
# 15
> Better than Citizen Kane?...I wasn't alive in 1941.
CaptainMorgan08a at 2007-7-21 20:26:24 > top of Java-index,Java Essentials,New To Java...
# 16
> > > Is 300 good? I want to see that.> > > > It's probably the best movie I've ever seen.> > Better than Citizen Kane?Probably not. But if we're talking about classics: 12 Angry Men is IMO far better!
prometheuzza at 2007-7-21 20:26:24 > top of Java-index,Java Essentials,New To Java...
# 17
> > Better than Citizen Kane?> > ...I wasn't alive in 1941.True, but where you alive in 480 BC? :-)
DrLaszloJamfa at 2007-7-21 20:26:24 > top of Java-index,Java Essentials,New To Java...
# 18
> > > Better than Citizen Kane?> > > > ...I wasn't alive in 1941.> > True, but where you alive in 480 BC? :-)No, but I was alive in 2007 when the movie was made. ;-)
CaptainMorgan08a at 2007-7-21 20:26:24 > top of Java-index,Java Essentials,New To Java...