Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #22651

Re: Boolean

Newsgroups comp.lang.java.programmer
Date 2013-03-01 07:50 -0800
References <38e873e0-549a-417c-b45b-9b9d52f65880@googlegroups.com>
Message-ID <04c665c9-c96c-497e-b94d-c8379ae44098@googlegroups.com> (permalink)
Subject Re: Boolean
From odie4penname@gmail.com

Show all headers | View raw


Thanks all. Yes, the assignment is simply to show it works correct. This is my second time working with BluJ. I am just starting to learn.


I am not sure if this part is correct:

public static void main(String [] args)
    {
        int x=1;

-Should it be int num=1;  ?

Here is more details of my assignment. I hope this helps in understanding in case I was vague in my prior posts:


invoke this method for the following values for the num parameter (in the specified order)
You can do this directly from main or from some other method / methods invoked by main.
When the method is invoked, one of the calling methods must output the appropriate
message.

In other words:
 if we passed the value
0 as an argument to num,
 it would display this message (on a line by itself):

 isNumberOdd is false for the number 0


On Thursday, February 28, 2013 11:22:49 PM UTC-8, odie4p...@gmail.com wrote:
> Hello everyone,
> 
> 
> 
> I'd like to make sure I have done this correct. I am using BluJ:
> 
> 
> 
> Create a public boolean method named
> 
> MynumberisOdd that takes an integer parameter named 
> 
> num and returns a boolean value indicating whether num is Odd.
> 
> 
> 
> The method should check if num is odd and return true when the number is odd and false when the number is even
> 
> 
> 
> Here is what I have:
> 
> 
> 
> 
> 
> public class example
> 
> 
> 
> {
> 
>     public static void main(String [] args)
> 
>     {
> 
>         int x=1;
> 
> 
> 
>     }
> 
> 
> 
>     public boolean isNumberOdd (int num)
> 
>     {
> 
>         return num%2 !=0;
> 
>         
> 
> 
> 
>         
> 
>     }
> 
> }

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Boolean odie4penname@gmail.com - 2013-02-28 23:22 -0800
  Re: Boolean JLP <JLP@jlp.com> - 2013-03-01 09:18 +0100
    Re: Boolean odie4penname@gmail.com - 2013-03-01 06:42 -0800
      Re: Boolean Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-03-01 10:25 -0500
    Re: Boolean Lew <lewbloch@gmail.com> - 2013-03-01 11:21 -0800
      Re: Boolean JLP <JLP@jlp.com> - 2013-03-04 09:12 +0100
        Re: Boolean Lew <lewbloch@gmail.com> - 2013-03-04 11:38 -0800
          Re: Boolean Lew <lewbloch@gmail.com> - 2013-03-04 11:45 -0800
            Re: Boolean Lew <lewbloch@gmail.com> - 2013-03-04 15:06 -0800
              Re: Boolean JLP <JLP@jlp.com> - 2013-03-05 11:45 +0100
          Re: Boolean Arne Vajhøj <arne@vajhoej.dk> - 2013-03-06 20:19 -0500
            Re: Boolean lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-03-07 08:50 +0000
              Re: Boolean Gene Wirchenko <genew@telus.net> - 2013-03-07 09:58 -0800
                Re: Boolean Lars Enderin <lars.enderin@telia.com> - 2013-03-07 19:24 +0100
                Re: Boolean lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-03-07 19:11 +0000
                Re: Boolean lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-03-07 19:21 +0000
                Re: Boolean Gene Wirchenko <genew@telus.net> - 2013-03-12 09:10 -0700
                Re: Boolean Patricia Shanahan <pats@acm.org> - 2013-03-12 09:54 -0700
                Re: Boolean markspace <markspace@nospam.nospam> - 2013-03-12 10:04 -0700
                Re: Boolean Lew <lewbloch@gmail.com> - 2013-03-12 12:02 -0700
              Re: Boolean Arne Vajhøj <arne@vajhoej.dk> - 2013-03-07 13:50 -0500
                Re: Boolean lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-03-07 19:00 +0000
                Re: Boolean Arne Vajhøj <arne@vajhoej.dk> - 2013-03-07 14:10 -0500
                Re: Boolean lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-03-07 19:25 +0000
              Re: Boolean Arne Vajhøj <arne@vajhoej.dk> - 2013-03-07 13:52 -0500
                Re: Boolean Lars Enderin <lars.enderin@telia.com> - 2013-03-07 23:27 +0100
                Re: Boolean Arne Vajhøj <arne@vajhoej.dk> - 2013-03-07 17:46 -0500
                Re: Boolean lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-03-08 09:22 +0000
                Re: Boolean lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-03-08 08:16 +0000
                Re: Boolean Lars Enderin <lars.enderin@telia.com> - 2013-03-08 10:30 +0100
                Re: Boolean lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-03-08 15:00 +0000
                Re: Boolean Lars Enderin <lars.enderin@telia.com> - 2013-03-09 01:37 +0100
                Re: Boolean lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-03-09 08:40 +0000
                Re: Boolean Lars Enderin <lars.enderin@telia.com> - 2013-03-09 09:54 +0100
                Re: Boolean lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-03-09 09:08 +0000
                Re: Boolean Lars Enderin <lars.enderin@telia.com> - 2013-03-09 11:38 +0100
                Re: Boolean lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-03-09 12:01 +0000
  Re: Boolean odie4penname@gmail.com - 2013-03-01 07:50 -0800
    Re: Boolean Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-03-01 11:14 -0500
  Re: Boolean Roedy Green <see_website@mindprod.com.invalid> - 2013-03-01 09:08 -0800
    Re: Boolean Joerg Meier <joergmmeier@arcor.de> - 2013-03-01 18:26 +0100
      Re: Boolean lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-03-01 19:37 +0000
        Re: Boolean Joerg Meier <joergmmeier@arcor.de> - 2013-03-01 21:44 +0100
        Re: Boolean Arne Vajhøj <arne@vajhoej.dk> - 2013-03-01 18:34 -0500
      Re: Boolean Arne Vajhøj <arne@vajhoej.dk> - 2013-03-01 18:33 -0500
      Re: Boolean Roedy Green <see_website@mindprod.com.invalid> - 2013-03-01 17:48 -0800
        Re: Boolean Joerg Meier <joergmmeier@arcor.de> - 2013-03-02 04:03 +0100

csiph-web