Java Tutorials.
Could someone please tell me where I can find some good beginner Java tutorials. It would be nice if they were easy to understand for a beginner. The thing I want to do Is make my first Jframe Gui, I'm installing netbean's IDE And Does anyone know where I can find tutorials for it?
Thanks,
Carl
Carl_B wrote:
Could someone please tell me where I can find some good beginner Java tutorials. It would be nice if they were easy to understand for a beginner. The thing I want to do Is make my first Jframe Gui, I'm installing netbean's IDE And Does anyone know where I can find tutorials for it?
Thanks,
CarlThere are several at http://www.dgp.toronto.edu/~mjmcguff/learn/java/
Harry Starkers
Similar Messages
-
It is possible to download the java tutorials?
Hi all,
there is a place where I can download the java tutorials? I need them for a computer without connection to internet. I'm interested in all the tutorials, but the Thread and Swing tutorials are the ones that I need now.
TIA.
Jorge.At least the swing tutorial is there.
Thanks you.You're welcome. Good luck, and happy coding! -
Is there a link for older sun java tutorials?
Is there any link or archive of older sun java tutorials? For instance, I saw in the Swing tutorial a section on concurrency in Swing, but it references SwingWorker which is only in java 6 & I use java 5.
Thanks.prometheuzz wrote:
Sun's tutorials from 1999: [http://web.archive.org/web/19990219162022/http://java.sun.com/docs/books/tutorial/]
or
Other years: [http://web.archive.org/web/*/http://java.sun.com/docs/books/tutorial/]
Thanks!! -
Where can I find java tutorials
At first I found a few java tutorials at kidware.com but their tutorials cost 19.95. So I downloaded the freeware edition tutorial and it gave me four lessons. Now that I have read them all I can't find any other good tutorials for beginners. I tried sell some tutorials to buy it, but it was a bad idea. Please tell me where I could get good tutorials thanks.
You may have tried the following.
http://java.sun.com/docs/books/tutorial/information/download.html -
The Java Tutorials : Lesson Generics Question and Answers
Hello,
I've just finished reading the Generics Lesson from the Java Tutorials,
http://java.sun.com/docs/books/tutorial/java/generics/index.html
and was hoping to see the answers in the Question and Answer section at the end of the tutorial, but the link doesn't seem to be working.
Could someone please grade my answers?
The question is (copied from the Java Tutorials):
1. Consider the following classes:
public class AnimalHouse<E> {
private E animal;
public void setAnimal(E x) {
animal = x;
public E getAnimal() {
return animal;
public class Animal{
public class Cat extends Animal {
public class Dog extends Animal {
}For the following code snippets, identify whether the code:
* fails to compile,
* compiles with a warning,
* generates an error at runtime, or
* none of the above (compiles and runs without problem.)
a. AnimalHouse<Animal> house = new AnimalHouse<Cat>();
b. AnimalHouse<Dog> house = new AnimalHouse<Animal>();
c. AnimalHouse<?> house = new AnimalHouse<Cat>();
house.setAnimal(new Cat());
d. AnimalHouse house = new AnimalHouse();
house.setAnimal(new Dog());
My answers are:
a. fails to compile
b. fails to compile
c. compiles and runs without problem
d. compiles with a warning
I realize that I could re-read the tutorial, but aside from learning about Generics, I'm also trying to gauge how well I absorb new information, the first time I read it, so I would appreciate if someone could tell me if my answers are correct. Explanations for incorrect answers would also be appreciated.
ThanksHi,
as far as I understand it, and am able to explain, creating
new AnimalHouse<Cat>();has the knowledge (at compiletime) about the generic type Cat.
But as soon as this is assigned to
AnimalHouse<?> house = new AnimalHouse<Cat>();the variable house, this knowledge is lost for the variable house. So you have house which does not know the underlying generic type used. Then, there are either two options:
- allow adding anything via the set...-method
- do not allow adding/setting anything at all
In the first case, you would create the problem of being able to potentially add instances of types that do not have any relation to the originally used type Cat - which will cause problems (imagine setting a Car instance instead of a Cat instance and lateron expecting to retrieve something that should be a Cat but is a Car...).
So, the only safe option is the second one.
Weird to explain, but maybe there are better explanations around...
Bye. -
Where are the Java Tutorials' discussions?
Greetings,
I've been following the "Learning the Java Language" online training under the Java Tutorials for several weeks now. After a few days away, I noticed today that the users' comments, questions and compliments section at the bottom of each page is now gone.
What happened? Did I accidentally change some settings in my browser or were they removed by SUN itself?
Thanks in advance for the clarificationI would guess that Oracle took them out--just in case you have not noticed: there really isn't any "Sun" any more.
-
Using the java tutorials and im stuck!
Hey, soz to be a pain and post something probably rediculously easy! im trying to learn java going through the online tutorials, im at the end of the object orinetated programming chapter and am doing the followning task;
Exercises
Create new classes for each real-world object that you observed at the beginning of this trail. Refer to the Bicycle class if you forget the required syntax.
For each new class that you've created above, create an interface that defines its behavior, then require your class to implement it. Omit one or two methods and try compiling. What does the error look like?
here is the code i have done for task one so far, but it wont compile, please dont tell me the answers, can you tell me where i am going wrong and suggest ideas for improvments and then ill post my reply here and tell me if i am right? thank you
class Television
int poweron = 1;
int poweroff = 0;
int channel = 1;
void change poweron (int increment)
poweron = poweron + increment;
void change poweroff (int increment)
poweroff = poweroff + increment;
void change channel (int newValue)
channel = newValue;
}i have the two codes,
this one
class Television
int poweron = 1;
int poweroff = 0;
int channel = 1;
void changepoweron (int increment)
poweron += increment;
void changepoweroff (int increment)
poweroff += increment;
void changechannel (int newValue)
channel = newValue;
void printStates()
System.out.println("poweron"+poweron+" poweroff:"+poweroff+" channel:"+channel);
}and this one
class TelevisionChange
public static void main (String[] args)
Television newTV = new Television ();
newTV.changepoweron(0);
newTV.changepoweroff(1);
newTV.changechannel(6);
newTV.printStates();
}both are stored in the same folder on my computer, c:\user\documents\textpad stuff
when i compile them there is no eror in textoad but then when i goto run java application using the television class i get the following error;
exception in thread main java.lang.nosuchmethoderror: main press any key to continue, when i compiile and run the other code i get a massive error saying
Exception in thread "main" java.lang.NoClassDefFoundError: televisionchange (wro
ng name: TelevisionChange)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
4)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
Press any key to continue . . . -
Sun Java Tutorials: java.lang.NoClassDefFoundError:
Hi,
I have recently started with java and been running through the Tutorials.
Here is my computer setup:
Windows EXP Pro
J2SE and NetBeans IDE Bundle NB 4.1 / J2SE 5.0 Update 3 FCS
Firefox 1.0.4 (java/javascript enabled)
Eclpise 3.1.0
I have been encountering the following problem quite often with those tutorials:
Some of those just wont work on my browser eg. http://java.sun.com/docs/books/tutorial/2d/display/ShapeMover.html
Java console gives following errors:
java.lang.NoClassDefFoundError: SMCanvas
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
However some of them work just fine. eg.
http://java.sun.com/docs/books/tutorial/2d/images/BufferedShapeMover.html
If I download the code for them and compile using the Eclipse3.1.0, everything works just fine.
Can this be a problem with the classpath variable? I honestly don't understand anything about using that, but since some of those work and some don't, I don't believe it is a problem with classpaths (but what do I know...).
So, if you have any advise to give I'd be grateful for it.So, if you have any advise to give I'd be grateful for it.The problem is not yours or your classpath (as the prior replies indicate.)
It's caused by erroneous, missing or mislocated files at the Java Tutorial website.
The Tutorial html file that's executed when you click the link in the page specifies the location of the applet files - typically in a subdirectory. The class file or some other file can't be found, causing the error.
This has been a continuing problem with the Tutorial, apparently due to the updating that goes on. If you wish to let the Tutorial maintainers, know about the error, there's a link on the Tutorial's main page. -
CharSequenceDemo in the Sun Java Tutorials
Having spent the last 30 years doing Prime Information/Infobasic, I'm trying to get my head around the basics of Java.
I need help with interpreting what is going on in this method, from CharSequenceDemo.java: (my line numbers)
1. public CharSequence subSequence(int start, int end) {
2. if (start < 0) {
3. throw new StringIndexOutOfBoundsException(start);
4. }
5. if (end > s.length()) {
6. throw new StringIndexOutOfBoundsException(end);
7. }
8. if (start > end) {
9. throw new StringIndexOutOfBoundsException(start - end);
10. }
11. StringBuilder sub =
12. new StringBuilder(s.subSequence(fromEnd(end), fromEnd(start)));
13. return sub.reverse();
14. }
To my, perhaps old-fashioned, brain, it looks as though line 12 invokes the method containing it, since string s is defined in main() as a a CharSequenceDemo type, and subSequence is this very same method within its instantiating class (CharSequenceDemo), and is therefore a recursive method call. s.subSequence(fromEnd(end), fromEnd(start)) (in line 12) is a parameter which must be evaluated for use in the StringBuilder constructor, surely? But when I run the program with debug statements, its obvious that there's nothing recursive about it.
Please can someone help sort out my misunderstanding of what's going on here?
The whole class is:
// CharSequenceDemo presents a String value -- backwards.
public class CharSequenceDemo implements CharSequence {
private String s;
public CharSequenceDemo(String s) {
//It would be much more efficient to just reverse the string
//in the constructor. But a lot less fun!
this.s = s;
//If the string is backwards, the end is the beginning!
private int fromEnd(int i) {
return s.length() - 1 - i;
public char charAt(int i) {
if ((i < 0) || (i >= s.length())) {
throw new StringIndexOutOfBoundsException(i);
return s.charAt(fromEnd(i));
public int length() {
return s.length();
public CharSequence subSequence(int start, int end) {
if (start < 0) {
throw new StringIndexOutOfBoundsException(start);
if (end > s.length()) {
throw new StringIndexOutOfBoundsException(end);
if (start > end) {
throw new StringIndexOutOfBoundsException(start - end);
StringBuilder sub =
new StringBuilder(s.subSequence(fromEnd(end), fromEnd(start)));
return sub.reverse();
public String toString() {
StringBuilder s = new StringBuilder(this.s);
return s.reverse().toString();
//Random int from 0 to max.
private static int random(int max) {
return (int) Math.round(Math.random() * max + 0.5);
public static void main(String[] args) {
CharSequenceDemo s =
new CharSequenceDemo("Write a class that implements the CharSequence interface found in the java.lang package.");
//exercise charAt() and length()
for (int i = 0; i < s.length(); i++) {
System.out.println(s.charAt(i));
//exercise subSequence() and length();
int start = random(s.length() - 1);
int end = random(s.length() - 1 - start) + start;
System.out.println(s.subSequence(start, end));
//exercise toString();
System.out.println(s);
}It's hard to read code that isn't formatted. Please press the code button and paste the code between the generated tags next time you post code.
It looks like there one subSequence method in the CharSequenceDemo class, but there's also a subSequence method in the String class.
s.subSequence(....)"s" is a reference to a String, so that invokes subSequence in the String class.
Kaj -
RE: ClickMe.applet, Under the JAVA Tutorials
Downloaded the provided source only to have compile errors on it.
http://java.sun.com/docs/books/tutorial/java/concepts/practical.html
I can compile the Spot.java successfully, get errors on the ClickMe.java...
I am using the JDK1.3.1
my CLASSPATH="C:\JDK1.3.1\bin"
and I have also tried
CLASSPATH="C:\JDK13~1.1\bin"
Is the JDK1.3.1 not backwards compatible?
or has there been any major syntaxx changes since the JDK1.1.1
Please help...C:\jdk1.3.1\bin>javac ClickMe.java
ClickMe.java:6: cannot resolve symbol
symbol : class Spot
location: class ClickMe
private Spot spot = null;
^
ClickMe.java:28: cannot resolve symbol
symbol : class Spot
location: class ClickMe
spot = new Spot(RADIUS);
^
2 errors -
Hi, is there any good website where we can find video java tutorials / video class teaching on topics like multithreading, JMS (Java Messaging Service) and Networking / Socket Programming .
Hi, This was my first question , so by mistake i cross posted.
I will take care of this in future. -
Java Video Tutorials / Class Teaching
Hi, is there any good website where we can find video java tutorials / video class teaching on topics like multithreading, JMS (Java Messaging Service) and Networking / Socket Programming .
Java is very light on "video tutorials". YouTube might have some but they are normally poop.
-
Hi!
Can anyone suggests some good tutorials on Java to start.
Thanks.Fguy wrote:
Chortle java is very newb friendly, I found that many parts of the Sun java tutorials were much easier to digest after going through this one first.
[http://chortle.ccsu.edu/CS151/cs151java.html]
Edited by: Fguy on Aug 21, 2009 10:38 PMSeconded... Chortle is an excellent "first cup" for Java noobs... it's not as complete as Sun's (and others) tutorials, but glossing over the complications allows you to "get the basics down" before you decend into the realities of life.
IBM also has published a wide-range of high-quality tutorials, white papers, and even dicussion (green) papers.
I've also found javaworlds tutorials to be "good"... but they are "a bit patchy".
Also beware that you need to look at the publication date (and revision date, where available) of every tutorial/article before you read it. The older it is, the more likely it promotes "deprecated techniques". If it's more than say 10 years old treat it's content with a grain-of-salt... it may still be "current" if it discusses areas which haven't changed (much) in ten years (e.g sockets); but beware that it may also be rendered "worse than useless" by fundamental changes in the API (e.g threading, generic collections).
As a plan of attack I'd recommend:
1. Read (but not necessarily do) the Chortle tutorial on the topic.
2. Read and DO the Sun tutorial... i.e compile the program(s), and play with them.
3. Go play on your own... produce a few SCCEE's of "the pertinent bits".
4. Now apply the principles/techniques/API's learned to your real problem.
Cheers. Keith. -
How can I use a Java program to write an executable Applescript
I'm using a PC with Windows XP. I'm a private developer. I've written a project in Java and wish to deploy it to other people using email. I've written an Install program (the Main-Class) and successfully packed this in a jar file with the project class files and some data files all as described in the deployment trail in the Java Tutorials. A recipient with a Mac with OS X downloads the jar file and runs it to install the project class files and some data files. The install program then writes an Applescript file (Vocab.scpt shown below) on the Desktop to make starting my downloaded program easier but it doesn't seem to work and I think it may be because the script file is not "executable". Could this be the case? If so, how could I change my install program to make the script file executable or alternatively use some other system to start the downloaded program?
Vocab.scpt:-
# Script to start: Vocab Version: 1.0.0
do shell script "cd /Applications/Vocab; Java Vocab"
Many thanks for your interest. Unfortunately I don't have a Mac to experiment with this problem and although I have spent some days on and off trying to find an answer in the mass of information available on Apple's website I can only find small clues here and there to answer my problem (which I would have thought was quite a common one). In Windows a batch file (eg. Vocab.bat) is automatically executable.I didn't expect you to have your customer run the command. I would expect you to create the executable and install it. However, there wouldn't be any difference in what you are creating and the .jar file. Either way it is a faceless icon. For that matter, it is no different than a batch file on Windows. I'm not sure what they wouldn't understand with, "copy the Vocab.jar file to wherever you want and double-click it to run the program." In addition, you probably ought to point out that Java is not installed on Mac OS X Lion (10.7.x) and when they double-click the jar file (or whatever you send them), the system will ask if they want to install Java.
What you really need to do is package up the app inside a Mac application package and provide the user with the application on a .dmg (disk image). Take a look here: http://developer.apple.com/library/mac/#documentation/Java/Conceptual/Jar_Bundle r/Introduction/Introduction.html#//apple_ref/doc/uid/TP40000884
I also found this which uses ANT to create the bundle: http://informagen.com/JarBundler/ -
How do I create a simple search program to search java console log
I wanted to know how can I write a simple program to return a particular value from the java console.
Let me give u a brief.
There is an application that I use, say "XYZ".Every time I perform an action on "XYZ" a log gets created in the java console. One such thing in the log I want to search is "ANI" and the program/script shud return the value adjacent to it.
Log Example:
NumCTIClients:0 CallType:CALLTYPE_PREROUTE_ACD_IN
ConnectionDeviceIDType:CONNECTION_ID_DYNAMIC
ConnectionCallID:4 ConnectionDeviceID:"0"
ANI:"9782755100" DNIS:"0006"
DialedNumber:"8002755010" CED:"1"
RouterCallKeyDay:145000 RouterCallKeyCallID:34320231
CallVariable1:"1234567" CallVariable2:"0"
CallVariable3:"0006" CallVariable5:"26000 123-45-6789
Not Valid " CallVariable6:"1001123-45-6789
26000000000038404LPCFAA" CallVariable7:"THIBAULT,
JOHN C. " CallVariable8:"CISCO
TESPHE " )
Now my understanding is that whenever java logs in the console it appends at the top, i.e, first record stays on top of the log sheet.
Now this script/program shud look up the top-most line which reads ANI and return the corresponding value which in the abv ex. was "9782755100"
I wud also want a small button when clicked wud copy the "9782755100" to the clip board
Edited by: SasK on Feb 9, 2008 6:09 PMdillmann74 wrote:
Hello all,
I am looking for a way to terminate a program when the user enters stop. I am using textpad, and I am running windows xp home. Here is where I need it....
System.out.print( "Enter employee name:" );
String nameOfEmployee = input.next();
System.out.println();
I need to be able to enter stop in the enter employee name area to terminate the program.
Thank you all for your advice.Do you know about if statements?
If not check out the java tutorials here
if you do then I don't understand your question.
Maybe you are looking for
-
How do I register an event as a value in an array?
I have a boolean which is True whenever data I am recording exceeds a certain value. What I want to do is keep a log of every time this happens and store it into an array, preferably in a way that each event has a new number (e.g. first event is logg
-
I have been using my original iPhone for over a year with just wifi in my home. My contract was up with at&t and I didn't renew it. The other day, I tried to reset the phone because it kept asking me if this was my current location. But I must hav
-
Hi I am getting following error while executing the DTP: 0MATERIAL : Data record 84 ('1-80200-01 '): Version '1-80200-01 ' is not valid. I know its because of space and I can correct it in PSA. But its loaded daily as full load and I dont want to c
-
Hi, trying to download CS3 onto a new computer running OS10.9.5. Any suggestions? thanks
-
HI , i am getting error when i am am editing RFX . when i am creating cfolfders i am getiing error. not authrized. but having sap all authorixation. what may be the problem Regards, S.Srinivasulu Reddy.