Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 16 of 16

Thread: One simple question...

  1. #1
    Junior Member
    Join Date
    Jun 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default One simple question...

    how would you answer the following question?

    "Every variable in a Java program must have a ___________, which indentifies the kind of data that it will store."

    would "declaration" be a valid answer to this question?

    what would be the best answer?


  2. #2
    Junior Member
    Join Date
    Jun 2012
    Posts
    18
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: One simple question...

    type is the right word in my opinion

  3. #3
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: One simple question...

    I guess the bigger question is, why do you think it would be declaration? The latter part of the question is a big hint itself - what identifies the kind of data a variable will store? See Primitive Data Types (The Java™ Tutorials > Learning the Java Language > Language Basics)

  4. #4
    Junior Member
    Join Date
    Jun 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: One simple question...

    Quote Originally Posted by copeg View Post
    I guess the bigger question is, why do you think it would be declaration? The latter part of the question is a big hint itself - what identifies the kind of data a variable will store? See Primitive Data Types (The Java™ Tutorials > Learning the Java Language > Language Basics)
    so what does that response mean? do you think that the correct answer is "type" or do you think that "declaration" is correct, or both?

  5. #5
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: One simple question...

    Quote Originally Posted by chrish View Post
    so what does that response mean? do you think that the correct answer is "type" or do you think that "declaration" is correct, or both?
    What that response was meant to do was to encourage to think about the question. What does declaration mean in the java language? What does variable mean? What does type mean? See java.sun.com/docs/glossary.html
    Last edited by copeg; June 25th, 2012 at 04:45 PM.

  6. #6
    Junior Member
    Join Date
    Jun 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: One simple question...

    I know what they all mean... A declaration requires just 2 things, a type, and a variable name. Pls answer what you think is correct.

  7. #7
    Junior Member
    Join Date
    Jun 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: One simple question...

    pls post a response if you have an opinion.

  8. #8
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: One simple question...

    Quote Originally Posted by chrish View Post
    pls post a response if you have an opinion.
    We aren't going to do your homework for you. You've been given a fantastic resource; I recommend you use it. Read through that tutorial and then tell us what you think it is- does a declaration identify the kind of data a variable will store? Or is it something else?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  9. #9
    Junior Member
    Join Date
    Jun 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: One simple question...

    Quote Originally Posted by KevinWorkman View Post
    We aren't going to do your homework for you. You've been given a fantastic resource; I recommend you use it. Read through that tutorial and then tell us what you think it is- does a declaration identify the kind of data a variable will store? Or is it something else?
    it isn't from homework; thanks for assuming though we all know what that does. it was a test question, btw.

  10. #10
    Junior Member
    Join Date
    Jun 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: One simple question...

    as far as I know a declaration does exactly that, it defines a variable's type and gives it a name.

  11. #11
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: One simple question...

    If it was a test question, didn't the teacher tell you the correct answer? Did you put declaration down? Did it get marked right or wrong?

    A declaration defines a variable's type and its name, but the question didn't ask about the name. It only asked about the kind of data stored in the variable.

    To be honest the question could probably be answered either way. One of them is more specific though, so which is correct really depends on your teacher.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  12. #12
    Junior Member
    Join Date
    Jun 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: One simple question...

    Quote Originally Posted by KevinWorkman View Post
    We aren't going to do your homework for you. You've been given a fantastic resource; I recommend you use it. Read through that tutorial and then tell us what you think it is- does a declaration identify the kind of data a variable will store? Or is it something else?
    just because i asked a simple question is no reason to talk down to me.

  13. #13
    Junior Member
    Join Date
    Jun 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: One simple question...

    the teacher said that declaration was wrong, but the way the question was worded i think that either one would be correct; declaring a variable defines it's type.

  14. #14
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: One simple question...

    Quote Originally Posted by chrish View Post
    just because i asked a simple question is no reason to talk down to me.
    I have no problems with simple questions. But you've been given great resources and answers, so the rest is on you. I haven't talked down to you, but the burden is on you to define each, let us know what you think, why you think it, etc. Actually, I gave you pretty much a completely full answer, and you're still complaining. Why would people want to continue helping somebody like that?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  15. #15
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: One simple question...

    Quote Originally Posted by chrish View Post
    the teacher said that declaration was wrong, but the way the question was worded i think that either one would be correct; declaring a variable defines it's type.
    Yes but the type is what defines what kind of data the variable will hold. The more specific answer is the more correct one.

    It's like if the test question had been "where is Washington DC?" and you answered "on Earth" when the teacher was looking for "in America" or even "right between Maryland and Virginia". Was your answer technically wrong? No. Should you get full credit for it? No.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  16. #16
    Junior Member
    Join Date
    Jun 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: One simple question...

    Quote Originally Posted by KevinWorkman View Post
    I have no problems with simple questions. But you've been given great resources and answers, so the rest is on you. I haven't talked down to you, but the burden is on you to define each, let us know what you think, why you think it, etc. Actually, I gave you pretty much a completely full answer, and you're still complaining. Why would people want to continue helping somebody like that?
    that post was in response to your previous one where you assumed wrongly that i was trying to get help with homework. look at the language, the whole thing is talking down, but yes, after that you were helpful.

Similar Threads

  1. Hi, i have a simple question.
    By oror84 in forum Java Theory & Questions
    Replies: 3
    Last Post: April 26th, 2012, 03:39 PM
  2. Simple Question (hopefully)
    By KILL3RTACO in forum Java Theory & Questions
    Replies: 2
    Last Post: October 11th, 2011, 09:18 PM
  3. Simple I/O Question...well could be simple for you?
    By basketball8533 in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: September 30th, 2011, 06:44 AM
  4. Help with a simple question
    By allea in forum What's Wrong With My Code?
    Replies: 3
    Last Post: May 28th, 2011, 07:46 AM
  5. not so simple, simple swing question box
    By wolfgar in forum AWT / Java Swing
    Replies: 2
    Last Post: November 20th, 2009, 03:47 AM