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


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

Re: I am unable to run my Bluej Code

From Andreas Leitgeb <avl@logic.at>
Newsgroups comp.lang.java.programmer
Subject Re: I am unable to run my Bluej Code
Date 2017-01-14 09:15 +0000
Organization A noiseless patient Spider
Message-ID <slrno7jr19.pvm.avl@logic.at> (permalink)
References <7bbab5d9-5eca-406b-bd0d-bb7caa28525a@googlegroups.com>

Show all headers | View raw


Yesi Gebre <yesi.gebreselassie@gmail.com> wrote:
> class ChkNum{
>     //return true if x is even 
>     boolean isEven(int x){
>         if((x % 2) == 0) return true;
>         else return false;
>        }
>     }

This is a NO-GO!  You make it look like this was end of
isEven, but it is already end of class ChkNum.  please
align all close braces with the column at which the line
with the matching open brace starts!

Maybe you even confused yourself into thinking that ParmDemo
was "inside" ChkNum.

>     class ParmDemo{

If the source file containing your code is called ParmDemo.java,
then you can make this class public, and then it might show up as
a possible starting class.

If the file is ChkNum.java or something completely different,
(which for non-public classes is possible), then rename it to
ParmDemo.java, first, and still make the class ParmDemo public.

>         public static void main(String args[]){
>             ChkNum e = new ChkNum();
>             if(e.isEven(10)) System.out.println("10 is even. ");
>             if(e.isEven(9)) System.out.println("9 is even. ");
>             if(e.isEven(8)) System.out.println("8 is even. ");
>         }
>         
> }
>
>
> I cannot run this program in Bluej .  When I go to run it void main string isn't there as one of the options.  Please Help

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


Thread

I am unable to run my Bluej Code Yesi Gebre <yesi.gebreselassie@gmail.com> - 2017-01-13 19:16 -0800
  Re: I am unable to run my Bluej Code Andreas Leitgeb <avl@logic.at> - 2017-01-14 09:15 +0000
  Re: I am unable to run my Bluej Code lewbloch@gmail.com - 2017-01-14 11:36 -0800
    Re: I am unable to run my Bluej Code Andreas Leitgeb <avl@logic.at> - 2017-01-14 20:23 +0000
      Re: I am unable to run my Bluej Code Arne Vajhøj <arne@vajhoej.dk> - 2017-01-14 19:49 -0500
      Re: I am unable to run my Bluej Code lewbloch@gmail.com - 2017-02-12 11:06 -0800

csiph-web