>But, Tyler’s explanation was incorrect because his was implying
that you can simply have as many classes in a file as you like, like
in c++, which isn’t
>the way java works.
You clearly misread my message... again. From what I've read you can
have more than one private class, but public classes you can only
have one per file.
On 7/31/2011 9:11 AM, Sina Bahram wrote:
Those classes would be inside another class, not inside
a file.
I viewed inside as having an immediacy of 1, not 2, not
3, not 5, and not any other number.
The water is inside a glass. If the glass happens to be
inside a fridge, then try asking about the glass of water
next time, *smile*.
But, Tyler’s explanation was incorrect because his was
implying that you can simply have as many classes in a file
as you like, like in c++, which isn’t the way java works.
I did think you might poke me on that though.
Take care,
Sina
Sina that was a pretty simplified description. If you
want to get technical you can have more than one class as
long as they are internal classes.
Ken
Please put each class in its own .java file. You can
only have one class per file. The class name must match both
in case and contents to the name provided to the filename.
Take care,
Sina
>Yes, all classes can be in a single .java file, or you
can have a .java file for each class.
I think you can only have a single public class per file.
On 7/30/2011 5:53 PM, Mike wrote:
Whether or not you realize it, you are way ahead of
yourself in Java for being a novice. I took a Java
course last semester, and interfaces were not
introduced. Interfaces will be introduced and used in
the second course. Below, I will attempt to answer your
questions as well as provide an additional resource for
learning Java so you are not getting ahead of yourself.
The HelloWorldApp had everything in it. It didn't need
a interface, why do we need to make a separate interface
for all our other classes?
You do not need to make an interface for each class.
This is where you skimmed too far ahead in the tutorial.
Why do we have to create an interface when the class
already has the same code in it?
Interfaces are for designing larger, complex
applications. Please do not worry about them at this
stage.
Do you save all classes as a .java file then use javac
to compile it into a .class file?
Yes, all classes can be in a single .java file, or you
can have a .java file for each class.
What do you save interfaces as?
Interfaces would also reside in .java files.
Personally, I find a good textbook better for
learning the programming thought process than an
online tutorial. Tutorials are great for explaining
language features, but leave out a lot of
information for the programming thought process. A
Java textbook I really like is called Introduction
to Programming Using Java and located at http://math.hws.edu/javanotes/.
This textbook is free and it does not matter whether
or not you have had programming experience. Bruce
Eckel’s Thinking in Java assumes previous experience
with the C language.
Finally, to address the whole group, I agree with
those who said working in an environment such as an
IDE is probably easier for a novice than the command
line. This will probably always be an on-going
debate, because there are pros and cons to both.
However, all I am going to add is that regardless of
the environment, you do not need to know everything
about that environment to get started writing basic
programs. Now, I personally like Sodbeans because
it is great for catching compiler errors in the text
editor and announcing them before you go through the
trouble of trying to build the application. This is
an excellent benefit! Now, Sodbeans is based on
Netbeans which is a huge environment, but don’t
worry about learning Netbeans. Focus on learning
the basics that will get you started writing simple
applications. I would be happy to help you get
started. In fact, a good mentor is often the best a
novice programmer can have, which is maybe why
mentors are hard to find. If you would like to
contact me, I use Skype. That would be the
easiest. My Skype username is foxwarrior09.
Sent: Saturday, July 30, 2011 6:46 PM
Subject: Re: Best Java Guides for a Newby?
I finally had time to go past the HelloWorldApp in
the tutorial. :D
Now I'm trying to create my own classes then run them
through my interface...
But I'm a little confused:
The HelloWorldApp had everything in it. It didn't
need a interface, why do we need to make a separate
interface for all our other classes?
Why do we have to create an interface when the class
already has the same code in it?
Do you save all classes as a .java file then use
javac to compile it into a .class file?
What do you save interfaces as?
I created a class for my heater:
/** creates the class for heater which has
temperature, speed and onOff
*/
class Heater }
int temperature = 0
int speed = 0
int turned = on
voide changeTemprature(int newValue) {
temperature = newValue;
}
voide speedUp(int increment) {
Speed = speed + increment;
}
voide slowDown(int decrement) {
Speed = speed - decrement;
}
voide turnOn() {
Turned = on;
}
voide turnOff() {
Turned = off;
}
voide printStates() }
System.out.println("temprature:"+temprature+"
speed:"+speed+" turned:"+turned);
}
}
Where do I put the lines like:
public static void main(String[] args)
Also do I have the right idea with the word after
void is the word I type to turnOn the heater?
And the word after (int is the word that could be
what ever I want it to be, it just needs to be the
same below?)
voide slowDown(int pizza) {
Speed = speed - pizza;
}
If you have any question, the interface for the
heater is:
voide changeTemprature(int newValue);
voide speedUp(int increment);
voide slowDown(int decrement);
Sorry, I didn't see answers to these questions in the
tutorials and I need to know this to do anything!
Sent: Thursday, July 07, 2011 6:50 AM
Subject: RE: Best Java Guides for a Newby?
That’s not learning a language Ken, that’s learning
an SDK, which implies one already knows how to use the
language.
I think you should start off with text as well, so
that six months later you aren’t asking basic
questions like why doesn’t this class run, because you
never had to put a mian method in it since Eclipse
always did that for you, etc. etc.
Of course, that implies that you actually want to
learn the fundamentals of the language, and not just
code.
Take care,
Sina
I have to disagree with this. There is nothing like
using eclipse when you’re learning a language. Let’s
say you are in Android and need to make an
Application. Ok so you start it up and there is an
Activity class. You’re in your text editor what do
you do?
You go out on line or into a document and try to read
up on all the possible functions you can run in an
activity. Not bad but why not make it quicker.
Just arrow to your myactivity and use the source menu
and go down and select override members. Then you can
arrow through the list of things you have that you can
do in that class. You check a few and tab down and
hit ok. Now you have 6 stub functions that work
perfect. You then go down to the keydown function
that you just added and arrow over keyEvent and
select help it tells you all the functions
Eclipse and Visual studio are not just environments
but they are great learning tools. Not to mention
learning the environment now with an easy program
will speed up both development of a harder program
but it also teaches you how to download other peoples
projects and get them running.
Heck for that matter if you don’t use eclipse you
have to learn another way to compile your project.
Which normally means you start compiling at the
command line with javac. That sounds easy but how
many of you have tried this and ran into the java path
problems. That is not something you want to get a new
user into right away. Then if you want to get real
bold and use ant as a new programmer you better have a
lot of antacid.
So I guess in short I just wanted to say sure Eclipse
is a big pig but the gains for a new coder is pretty
high if you learn to use it. Now if you’re on a Mac
sorry to hear it while I like Mac I have not been
impressed with the amount of work I had to go through
to get Eclipse set up. I use it on both Mac and
Windows but I will tell you there is nothing like
Eclipse and Jaws 12. I use no scripts and do just
fine.
Ken
Hi Brandon,
This is my opinion, so take with a grain of salt.
Right at the beginning with Java, I feel that you
should use a text editor. Personally, I prefer
EdSharp, but there are lots of good ones. Learn to
use the command line tools that come with the Java
Development Kit. After you have written some programs,
and you know what's going on with basic Java, start to
use something like Eclipse or Net Beans. I have no
experience with SodBeans, but I understand that that
package for NetBeans is making a big difference in
NetBeans accessibility. So scrap fancy editors for
now.
Jim
Thanks and I started reading those, the only
problem is I use Eclipse and these talk about the
Netbeans IDE which I think it is inaccessible.
My big question is: What are all the differences in
the different things you can create with the new
menu in Eclipse? There are like projects, classes,
Java projects and all kinds of other things that
aren't really talked about with Java.
Sent: Wednesday, July 06, 2011 9:36 AM
Subject: RE: Best Java Guides for a
Newby?
Hi,
I think that, as with many things, this is one of
those things that can be different, depending on the
learning style and knowledge of the person.
Speaking just for myself, I get more out of tutorial
style books, when I'm learning a language. I tend to
freeze up at reference type material that is full of
code and short on words, but that's my taste.
According to me, you will probably do well with the
nutshell books, if you already know lots of
programming concepts and want to see how certain
things are done in Java. On the other hand, you may do
better if you have little programming experience by
looking at the Java Tutorial, which takes things a
concept at a time and explains them with lots of words
and examples. You can see that at http://download.oracle.com/javase/tutorial/reallybigindex.html.
Thanks.
Jim
I would recommend if you have a subscription to
bookshare.org, that you download a copy of "Java in
a Nutshell". It is a nice summary of features with
some examples. I was going to read "Thinking in
Java, 4th edition", which I forked $25 for online,
but got a package that I cann't display on my
system. I have been unable to read more than the
preface, and most the time, the html just freezes
things. So I'm pitching it. A shame as it sounds
like a useful guide to using java the way it is
meant to be used.
Good luck and happy hacking.
----- Original Message -----
Sent: Wednesday, July 06, 2011 6:44 AM
Subject: Re: Best Java Guides for a Newby?
Hello Brandon,
Do you have any form of IM or perhaps skype? I
would like to help you but it's easier for me to
recommend something if i know a bit more about
your background.
Florian
On Jul 6, 2011, at 8:04 AM, Brandon Keith
(Biggs) wrote:
I'm new to programming, (I have just made
it past "Hello World") and am looking for
some guides.
I would like to learn Java, but I'm not
quite sure where to start. I downloaded the
500 or so documents from the "Java
Documentation" at:
as well as reading all the tutorials on
Eclipse and Java.
I've installed the SDK 1.6 and Eclipse, is
there anything else I need? I see there are
Jaws scripts for Eclipse, where do I insert
those?
I arrowed through the 500 documents dealing
with Java and found:
Java Tutorial 3rd Edition, a short course
on the basics
but I see it was written in 2001 and only
deals with Java 1.3 and Windows 2000 and
before. Is this something I should read?
What books best describe the language in an
exciting and useful format? I'm wanting to
eventually program for Android, but I think
that is stepping a little ahead of myself.
This e-mail and any attachments to it are
confidential and are intended solely for use of the
individual or entity to whom they are addressed. If
you have received this e-mail in error, please notify
the sender immediately and then delete it. If you are
not the intended recipient, you must not keep, use,
disclose, copy or distribute this e-mail without the
author's prior permission. The views expressed in this
e-mail message do not necessarily represent the views
of Highmark Inc., its subsidiaries, or affiliates.
--
Take care,
Ty
my website:
http://tds-solutions.net
my blog:
http://tds-solutions.net/blog
skype: st8amnd127
My programs don't have bugs; they're randomly added features!
--
Take care,
Ty
my website:
http://tds-solutions.net
my blog:
http://tds-solutions.net/blog
skype: st8amnd127
My programs don't have bugs; they're randomly added features!
|