|
Seun (m)
|
I think it's better to teach the basics of Java with the Netbeans IDE+Java pack.
|
|
|
|
|
|
sbucareer (f)
|
I agree with Seun, but people have different pace to learning. Eclipse may prove difficult at the initial stage, but if you have been doing some sort of programming before and have used some sort of IDE, then I will recommend downloading Netbeans+JDK 5.0 like Seun said.
This is the oficial website for Netbeans, you can find tutorials on quick start with java
Good Luck.
|
|
|
|
|
|
skima (m)
|
Am also working on attemptin the assignment. But i have not installed jdk. upto do that this weekend.
|
|
|
|
|
|
gbengaijot (m)
|
@sbucareer, can u please tell me how to compile, i dont knw how to. I downloaded the TXTPAd which is an IDE and i download the Java SDK and i already did the configuration at the advance setup. But how will i compile?, i already copypaste the codes on to the IDE txtpad. so how do i compile ooooo. someone tell me or else,, lol I want to learn, am a dummy plzzzzzzzzzzzzzzzzz give me a step by step instruction
|
|
|
|
|
|
skima (m)
|
go to your java directory and run this command;
example Note C:
C:\java> javac YourJavaFile.java
after that command u will have a YourJavaFile.class which is runable by the system
|
|
|
|
|
|
sbucareer (f)
|
Click here or Google
Remember the java source file name must be the same with class name
|
|
|
|
|
|
olat (m)
|
gbenga, this is what I did. Inside Textpad, go to Configure ---> Preferences --->
|
|
|
|
|
|
olat (m)
|
gbenga, this is what I did. Inside Textpad, go to Configure ---> Preferences ---> Click on Tools---> Complie Java Click on Apply ---> ok
Then u 'll go back to Txtpad, after writing your program. Go to Tools and click on Compile Java, its a piece of cake, right, sbucareer, I am attempting your assignment, shld be through @ the weekend.
|
|
|
|
|
|
sbucareer (f)
|
Do this, click on tools and find compile when it has compiled successful, go back and click run. You must make sure you PATH is set
|
|
|
|
|
|
gbengaijot (m)
|
Thanks guys, i will do this when i get home tonite. Am at work and am not allowed on the internet( i snkead to check nairaland-can u imagine am an addict)
|
|
|
|
|
|
sbucareer (f)
|
Tutorial addition
Let look at Java Reserved keywords. What is java reserved work. These words are reserved as you cannot use any of these words as names in your programs. Remember that true, false, and null are not keywords but they are reserved words, so you cannot use them as names in your programs either.
What are names. It is refered to variable names, like in our above Radio software example, frequency and volume are variable names that holds information about the Object called Radio. Remember that variable names are devlopers choice, and can be confusing if a devloper do not choose appropriate name depicting the issue at hand.
Therefore java has come up with reserved keyword that can never be used or allowd to be used by developer to asigning their variable the reserved keywords. It is equally important you understand these keywords as you program will fail to compile if you used them.
| abstract | continue | for | new | switch | | | assert | default | goto | package | synchronized | boolean | | do | if | private | this | break | double | | implements | protected | throw | byte | else | import | | public | case | enum | instanceof | return | transient | | catch | extends | int | short | try | char | | super | while | native | class | finally |
The keywords above are the ones I can remember, if you need to know all the keywords vist here
|
|
|
|
|
|
gbengaijot (m)
|
Have just got home now and do exactly waht i read. but i think am missing a point coz i just wasnt able to compile despite that i did conmfigure the preferences
|
|
|
|
|
|
sbucareer (f)
|
Gbenga, I can see you code has NOT been saved, as the name on the left navigational panel still says Document1*. The * means it has not been saved after the last modification. Besides, I told you that you must save the file as the same name as the class, for exaple.
If I have a class called HelloWorld like below
import java.lang.*;
public class HelloWorld extends Object{ public static void main (String args[]){ System.out.println("Hellow World"); }//End main }//End program HelloWorld
I MUST save the class as HelloWorld.java
|
|
|
|
|
|
gbengaijot (m)
|
Mmmmmmmmmmmmmmmm, Thanks for your patient SBU, i have saved it like you said and mmmmmmmm, i wonder why i still not get it. Maybe i am only confused. I still experience thesame thing. Do help me I created a blog topic for this thread, visit it at www.gbenga.blog.com , wrote something about u
|
|
|
|
|
|
sbucareer (f)
|
Ok, gbenga explain to me the problems you are having with texpad? Does it compile? Does it not run? I want you to do something for me. Go to your command line, I can see you are using window XP. From the start button click run and type cmd and click ok.
The command line interface will come up, at the prompt type c:\>java -verson. if you see this picture below that means your path is working if not you need to go here and configure your path
The textpad is not showing the compile option because it cannot see your path to java.
|
|
|
|
|
|
Seun (m)
|
Ok, gbenga explain to me the problems you are having with texpad?
That is why I suggested the use of the Netbeans IDE. Problems with Java should be about Java itself and not "Textpad" or other third party tools. With Netbeans, compiling your program is as easy as pressing a function key!
|
|
|
|
|
|
sbucareer (f)
|
I have found another good IDE for java. Although I have not download and install it, I have otherwise read the requirements and people behind the development and it seems promising. The good thing about Dr java is that it is free.
If anyone is going to us it for this tutorial could you evaluate for like three weeks for us and post you thoughts about the IDE. It is a lightweight IDE. Gbenga, if you cannot get textpad to work I will recommend this as it does not require you to configure your path. Dr java comes with java 1.4 or 1.5 integrated into one download and does the whole path configuration all you need to do it write your code and compile.
Good luck
Note -----------------
I agree with Seun, but people have their pace of learning and that does not make them incompetent. Netbean is easy to learn for people that have done some sort of programming in the past with other IDE and to adapt to new IDE will be easy. But in this case, a newbie cannot get textpad configured, it show how difficult it will really find Netbean. Mind you in Netbean, you have to add your jar to the environment which is like setting path, that could prove challenging to newbies.
But I see your point and would recommend it for intermediate programmers wanting to learn java.
|
|
|
|
|
|
olat (m)
|
sbucareer, could u please, help me debug this error-just 1 error in compiling. Meanwhile, I must just appreciate your effort and your patience.
|
|
|
|
|
|
mochafella (m)
|
@olat,
Your physical file is named "Helloworld" Your class is named "HelloWorld".
They both should be named "HelloWorld". Java is case-sensitive
|
|
|
|
|
|
olat (m)
|
@mochafella,
Thanx bros, I have done that and it works. So cool, I'm moving on to sbucareer assignment.
|
|
|
|
|
|
sbucareer (f)
|
I will be looking forward to seeing everyones Object Diagram and the Temperature.java class soon. It is nice to see you guys working hard to get the textpad to compile HelloWorld. Now that is out of the way, let do some serious software engineering.
Remember to upload your diagram first with accompanying Classes and probably the TemperatureDemonstration.java as well. Those that completed these tasks are the ones I will respond to their questions.
Thanks again guys, you guys are brilliant learner, and believe me with this attitude soon you will become Sun Certified Java Associate (SCJA)
|
|
|
|
|
|
skima (m)
|
its funny when i discovered that the java compiler that i have been having problem to download comes with dreamweaver. I just discovered it to ("sunday"). and since tried to compiled the hello world app. i only save the file to the bin directory where the javac.exe exist and compile then ran, it worked straight away with textpad.
Java's cool. Am going with the assignment.
|
|
|
|
|
|
qleyo (f)
|
Hey, good job with the teaching SBU!
I do however think teaching everyone the basics of C would have been better, than expanding to C++ before touching Java. That way people appreciate all three languages and see the difference between the former and java.
I've got over 4 years experience with C and 2 with C++ (software and embedded). I'm willing to help if you need anything.
We probably should do a seperate one for C.
|
|
|
|
|
|
olat (m)
|
@gleyo, we wouldn't mind learning from you too. Its so sweet that u guyz, r willing to doll out from your knowledge and experience. You could just give us sometimes to go a lenght with SBU on Java.
Let me quickly get back to my assignment, I've to submit tonight else SBUcareer may be discouraged.
|
|
|
|
|
|
skima (m)
|
@qleyo ill advice u(or some1 should) open a new thread for C/C++ , i dont think any knowledge is a waste.
|
|
|
|
|
|
skima (m)
|
My assignment :
the diagram below
|
|
|
|
|
|
skima (m)
|
import java.lang.Object
public class Temperature extends Object {
private int celsius = 0; private int farhenheit = 0; protected boolean tempOkay = false;
//i want to build the constructor now
public Temperature (int newcelsius, int newfarhenheit){
celsius = newcelsius; farhenheit= newfarhenheit; tempOkay= true;
}//end constructor
//build celsius method public int getCelsius( ){ return celsius; }//End getCelsius
public void setCelsius (int extCelsius){ celsius = extCelsius; }//End setCelsius
public int getFarhenheit( ){ return farhenheit; }//End getCelsius
public void setFarhenheit (int extFarhenheit){ farhenheit = extFarhenheit; }//End setFarhenheit
public boolean isTemperatureOk(){ return tempOkay; }//End isTemperatureOk
}//end class
|
|
|
|
|
|
skima (m)
|
Demonstration class below:
import java.lang.Object;
public class TemperatureDemonstration extends Object {
//lets instantial our class , but at first set it to null static private Temperature firstObject = null; static private Temperature secondObject = null;
public static void main (String args[]){
//We are going to instantiate two objects we created above firstObject = new Temperature (32, 8 ) ; secondObject = new Temperature (55, 6);
//Testing the new Objects or querying their attributes
System.out.println ("Preset first object value: "+firstObject.getCelsius()); System.out.println("Preset second object value: "+secondObject.getFarhenheit());
//Changing the identity of the objects we create above, hence assigning new values to their attribute. firstObject.setCelsius(3); secondObject.setCelsius(10);
//Testing the new Objects or querying their attributes System.out.println ("New value for the first object: "+firstObject.getCelsius()); System.out.println("New value for the second object: "+ secondObject.getCelsius());
//Lets check if temperature is ok String tempVal=new String(); if(firstObject.isTemperatureOk()){ tempVal="Temperature is ok"; }
System.out.println(tempVal); }// end print to system
}//end TemperatureDemonstration
|
|
|
|
|
|
skima (m)
|
The classes have been compile and ran.
its will print if temperature is ok using the boolean method isTemperatureOk() built .
|
|
|
|
|
|
sbucareer (f)
|
Skima good work. I am impressed and very delightful that at least one person has attempted the task. You have showed great courage and good understanding and I will focus this tutorial around you and gbenga when I receive his work and other people.
Now, Skima your class diagram is very good but need a little modification like, the methods do not have bracket in Class Diagram . Every rectangle depicting method MUST show the reader if the method accepts/return attributes by using arrows. Out arrow i.e. -----------> will show that the method will return an attribute, <--------------- will show that the method will accept an attribute. Remember that if you method accepts/return several attributes must be shown using several arrows.
When you depict your attribute it is wise to say in the box what type of attribute that it. by doing this Celsius: String I know I did not showed it at the beginning but I was looking to see if any body will do some background reading to find this out by themselves. Off course that is the only way to learn, by doing additional reading.
Finally, you Temperature class has boolean attribute initialised to true. This can never happen. The Temperature class is a template. It will be instantiated into many objects in its later life, which will mean that all the Temperature artefact will be working/ok, which is NOT true.
Every attributes in a template class MUST be initialised to
1. Zero value in the case of int 2. Null value in the case of Object 3. false value in the case of boolean 4. 0.0 value in the case of double/float 5. '' in the case of char
In your TemperatureDemonstration is where you could have initialised that particular object to be working hence setting tempOk to true.
In general, you have done good work and I will progress to the second phase of my tutorial. I will compile the second phase when I get back from work. That will give others more time to upload their work if their have done it that is?
|
|
|
|
|
|
sbucareer (f)
|
Class Diagram Dont worry if your diagram do not look like this, with more practice you will become good in drawing class diagrams. Remember when you are in the work industry as a developer/programmer all you get is a Class Diagram or a UML Diagram and you must produce a software/codes base on the UML or class diagram. At the end of this tutorial I will help you to get started with UML
|
|
|
|
|
|
olat (m)
|
SBU, Please, find attached my assignment. I should have submitted earlier on Tuesday morning but for the fact that the system was down. I guess I miss out on the Class demonstration stuff. I will be awaiting your comments.
|
|
|
|
|
|