Java Programming For Dummies

Welcome. Please Login, Register, Or Activate! 
type your username and password to login
Date: November 08, 2009, 03:50 AM
423497 members and 291072 Topics
Latest Member: o.b
Nairaland [Nigerian Forum] Home Help Search Who is currently online? Login Register
Nairaland Forum  |  Technology  |  Programming  |  Java Programming For Dummies
Pages: (1) (2) (3) (4) (5) (6) (7) (8) (9) Go Down Send this topic Notify of replies
Author Topic: Java Programming For Dummies  (Read 19188 views)
Seun (m)
Re: Java Programming For Dummies
« #32 on: February 16, 2006, 04:20 AM »

I think it's better to teach the basics of Java with the Netbeans IDE+Java pack.
sbucareer (f)
Re: Java Programming For Dummies
« #33 on: February 16, 2006, 05:07 AM »



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)
Re: Java Programming For Dummies
« #34 on: February 16, 2006, 04:53 PM »

Am also working on attemptin the assignment. But i have not installed jdk. upto do that this weekend.

gbengaijot (m)
Re: Java Programming For Dummies
« #35 on: February 17, 2006, 12:57 AM »

@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)
Re: Java Programming For Dummies
« #36 on: February 17, 2006, 01:07 AM »

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)
Re: Java Programming For Dummies
« #37 on: February 17, 2006, 01:08 AM »


Click here or Google

Remember the java source file name must be the same with class name

olat (m)
Re: Java Programming For Dummies
« #38 on: February 17, 2006, 01:16 AM »

gbenga, this is what I did.  Inside Textpad, go to Configure ---> Preferences --->
olat (m)
Re: Java Programming For Dummies
« #39 on: February 17, 2006, 01:19 AM »

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)
Re: Java Programming For Dummies
« #40 on: February 17, 2006, 01:25 AM »


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.gif (84.91 KB, 796x901 )
gbengaijot (m)
Re: Java Programming For Dummies
« #41 on: February 17, 2006, 02:28 PM »

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)
Re: Java Programming For Dummies
« #42 on: February 17, 2006, 08:16 PM »

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.


abstractcontinuefornewswitch
assertdefaultgotopackagesynchronizedboolean
doifprivatethisbreakdouble
implementsprotectedthrowbyteelseimport
publiccaseenuminstanceofreturntransient
catchextendsintshorttrychar
superwhilenativeclassfinally

The keywords above are the ones I can remember, if you need to know all the keywords vist here
gbengaijot (m)
Re: Java Programming For Dummies
« #43 on: February 17, 2006, 10:36 PM »

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


* untitled.JPG (99.22 KB, 1024x768 )
sbucareer (f)
Re: Java Programming For Dummies
« #44 on: February 17, 2006, 11:13 PM »


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


* gben.gif (117.36 KB, 956x983 )
gbengaijot (m)
Re: Java Programming For Dummies
« #45 on: February 17, 2006, 11:46 PM »

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


* untitled2.JPG (72.79 KB, 1024x768 )
sbucareer (f)
Re: Java Programming For Dummies
« #46 on: February 18, 2006, 12:20 AM »



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.




* gben1.gif (113.94 KB, 912x847 )
Seun (m)
Re: Java Programming For Dummies
« #47 on: February 18, 2006, 12:34 AM »

Quote from: sbucareer on February 18, 2006, 12:20 AM
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)
Re: Java Programming For Dummies
« #48 on: February 18, 2006, 12:39 AM »



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)
Re: Java Programming For Dummies
« #49 on: February 18, 2006, 05:53 AM »

sbucareer, could u please, help me debug this error-just 1 error in compiling.
Meanwhile, I must just appreciate your effort and your patience.


* javaerror.JPG (75.2 KB, 1024x852 )
mochafella (m)
Re: Java Programming For Dummies
« #50 on: February 18, 2006, 06:36 AM »

@olat,

Your physical file is named "Helloworld"
Your class is named "HelloWorld".

They both should be named "HelloWorld". Java is case-sensitive
olat (m)
Re: Java Programming For Dummies
« #51 on: February 18, 2006, 07:07 AM »

@mochafella,

Thanx bros, I have done that and it works. So cool, I'm moving on to sbucareer assignment.


* javaresult.GIF (36.24 KB, 717x597 )
sbucareer (f)
Re: Java Programming For Dummies
« #52 on: February 18, 2006, 01:59 PM »



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)
Re: Java Programming For Dummies
« #53 on: February 19, 2006, 02:39 PM »

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)
Re: Java Programming For Dummies
« #54 on: February 20, 2006, 07:40 PM »

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)
Re: Java Programming For Dummies
« #55 on: February 20, 2006, 08:01 PM »

@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)
Re: Java Programming For Dummies
« #56 on: February 20, 2006, 09:44 PM »

@qleyo ill advice u(or some1 should) open a new thread for C/C++ ,  i dont think any knowledge is a waste.
skima (m)
Re: Java Programming For Dummies
« #57 on: February 22, 2006, 08:54 AM »

My assignment :

the diagram below


* java.gif (28.73 KB, 500x500 )
skima (m)
Re: Java Programming For Dummies
« #58 on: February 22, 2006, 08:57 AM »

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)
Re: Java Programming For Dummies
« #59 on: February 22, 2006, 09:00 AM »

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)
Re: Java Programming For Dummies
« #60 on: February 22, 2006, 09:04 AM »

The classes have been compile and ran.

its will print if temperature is ok using the boolean method isTemperatureOk() built .

sbucareer (f)
Re: Java Programming For Dummies
« #61 on: February 22, 2006, 05:38 PM »


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)
Re: Java Programming For Dummies
« #62 on: February 22, 2006, 05:57 PM »

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





* temperature.gif (5.57 KB, 619x555 )
olat (m)
Re: Java Programming For Dummies
« #63 on: February 22, 2006, 09:18 PM »

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.


java1.doc
* java1.doc (27 KB - downloaded )
java2.doc
* java2.doc (24 KB - downloaded )
Page 2
Pages: (1) (2) (3) (4) (5) (6) (7) (8) (9) Go Up Send Topic to Friend by E-mail Reply 


Sections: Autos/Cars (2) Jobs/Vacancies (2) (3) Career Talk Education General(2) Politics Romance Computers Phones Travel
Sports Fashion Health Religion Celebrities TV/Movies (2) Music/Radio (2) Books Webmasters Programming

Links: Page1 Page2 Page3 Page4 Page5 Page6 Page7 Page8 Page9 Page10

Nairaland is owned by Oluwaseun Osewa. See also: Nairalist Classified Ads
Nairaland Forum | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.