Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Andreas Leitgeb Newsgroups: comp.lang.java.programmer Subject: Re: I am unable to run my Bluej Code Date: Sat, 14 Jan 2017 09:15:12 -0000 (UTC) Organization: A noiseless patient Spider Lines: 38 Message-ID: References: <7bbab5d9-5eca-406b-bd0d-bb7caa28525a@googlegroups.com> Reply-To: avl@logic.at Injection-Date: Sat, 14 Jan 2017 09:15:12 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="b25bc1c2b925ca07c60e294da0b786ef"; logging-data="21524"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/K46DfoYtuRBUD7s72/SuY" User-Agent: slrn/1.0.2 (Linux) Cancel-Lock: sha1:E5havV7N//BSngFomIELdOSc+Dg= Xref: csiph.com comp.lang.java.programmer:36191 Yesi Gebre 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