Java Gurus Help!  
Author Message
Andrew.Bell





PostPosted: 2006-3-14 6:34:00 Top

java-programmer, Java Gurus Help! Yep, shall do i use limewire but you didn't no I typed that....... ;)

cheers Steve


 
Andrew.Bell





PostPosted: 2006-3-14 6:34:00 Top

java-programmer >> Java Gurus Help! Yep, shall do i use limewire but you didn't no I typed that....... ;)

cheers Steve


 
Andrew.Bell





PostPosted: 2006-3-14 6:36:00 Top

java-programmer >> Java Gurus Help! How would you code menus ?

Would you use Methods?


 
 
steve





PostPosted: 2006-3-15 6:47:00 Top

java-programmer >> Java Gurus Help! On Tue, 14 Mar 2006 06:35:59 +0800, Andrew.Bell wrote
(in article <4415f3ca$0$5003$email***@***.com>):

> How would you code menus ?
>
> Would you use Methods?
>
>

you need to destinguish what you mean by "menu's"
Actually that may be my fault, there are the pulldown menus, and then there
are user selection lists.



The way you are doing it is perfectly fine for the level you are working at,
in that you get credits for , a working program.

As you have a significant workload from your course, keep it simple, then if
later you really want to get into Java, then worry about it.

Steve



 
 
Oliver Wong





PostPosted: 2006-3-17 1:36:00 Top

java-programmer >> Java Gurus Help!
"Andrew.Bell" <email***@***.com> wrote in message
news:4415e3ce$0$29571$email***@***.com...
> I've tried using Methods but I'm confused about them. Ive looked up on
> the net about different Methods and found very little pages.

"method" is a word that has a special meaning in Java. If you try
googling for something like "Java programming method", Google might give you
pages about programming *methodologies*, which is something completely
different.

To put a simply, a method is basically a bunch of statements group
together, and given a name. In other programming languages, they're called
"function", "subroutine", "procedure", etc.

Here's the source code for a file which defines a class called "Foo"
which has a method called "bar".

<example>
public class Foo {
public static int bar() {
int x;
x = 5 + 3;
return x;
}
}
</example>

In case it isn't clear, here's the same code, but everything is stripped
away except for the method:

<example>
public static int bar() {
int x;
x = 5 + 3;
return x;
}
</example>

If you haven't covered object oriented design or classes yet, just put
"public static" before all your methods. Then, you have to specify the
return type of the method, the name, and then a list of arguments that the
method accepts (in this case, the list is empty; i.e. the method takes zero
arguments).

You should find yourself a good introductory Java textbook if you're not
familiar with methods, as they are pretty core to being able to write Java
programs.

- Oliver

 
 
Oliver Wong





PostPosted: 2006-3-17 2:51:00 Top

java-programmer >> Java Gurus Help! "Andrew.Bell" <email***@***.com> wrote in message
news:4415eae4$0$5013$email***@***.com...
>
> Ive got aomw book called 21 days learn java its a sams book.

Is it by Laura Lemay and Charles L Perkins? Honestly, I don't think it's
a very good book for learning Java. The book focuses too much on writing
applets, and not enough on the concepts behind programming itself, and
object oriented design.

- Oliver

 
 
Oliver Wong





PostPosted: 2006-3-17 2:53:00 Top

java-programmer >> Java Gurus Help!
"Andrew.Bell" <email***@***.com> wrote in message
news:441493ea$0$5190$email***@***.com...
> damn im so happy, haha ok thats me sorted for user picking 'user menu A'
> now onto 'user menu B' :)
>
> 6 hours of trying to find that mistake is beond a joke. :) lesson learnt
> though ill bare in that in mind what mistake I did for future
> reference.....
>
> if (andrew = = "stupid mistake") {
> System.out.println("Back to the drawing board")
> }
> else {
> System.out.printline("Congratulations! you found the mistake")
> }//end of stupid if
> }
>

The tiniest difference can radically alter the behaviour of your
program. That's why I'd like to point out you have an extra closing brace
'}' in the code snippet above. Good luck ;)

- Oliver

 
 
Oliver Wong





PostPosted: 2006-3-17 2:56:00 Top

java-programmer >> Java Gurus Help! "steve" <email***@***.com> wrote in message
news:email***@***.com...
> if i meant a string, i would code it like this:
>
> if customer.equals( new String ('1')){
> System.out.println("Customer 1");
> }

Does this compile? I think you mean:

<code snippet>
customer.equals(new String("1"))
</code snippet>

(Note that I use the double-quote character, rather than the single-quote).

Anyway, you should probably instead write:

<code snippet>
customer.equals("1")
</code snippet>

This avoids an extraneous String creation.

- Oliver