ReCom.org
Programming and Web Development Web monks and programmers welcomed

Intro to Java

Reply
 
Thread Tools
masterof_none
Administrator
Administrator
 
Join Date: Apr 2003
Posts: 834
  #1 Old 18-05-2003 Default Intro to Java

salam sejahtera to everybody,
first of all, thanks for your support.
I hope for now, my posting is going to be short since I'm not fully recovered from this syndrom.
Anyway, I'll give you an overview about why we create this Java slot in the first place and what can you expect from our humble effort.

Warning:
Everything that I write is just according to my understanding abt Java.
It might not be accurate. So, for those who spot my mistakes, please post it to the forum.Because,"to err is human,"

You may ask:
Why do you write this?
Actually, I'm writing this Java slot just for hobby while refreshing my memory about Java. Since programming really need everyday's practice, this forum on Java may suite my needs.

Can I join this forum if even I've never done programming?
Yes. You're welcome to come and post. Anything that you think you don;t understand, please don;t hesitate to post. I'm sure a lot of RC members know abt this good stuff already..they, including me will try our best to help you.

What is a programming language?
Language to tell computer what kind of stuff you like your computer to do.
Obviously, we can't speak Malay or English to our PC or laptop. or can we?

What is Java?
Not to confuse with an island in the south of Malaysian peninsula, or a mere cup of coffee, Java is a powerful programming language.

What's the difference between Java and C++?.
Too much to talk abt here, but the obvious ones are:
1. In Java, everything is pointers.In C/C++, not all of them are pointers.
2. In Java, all objects are dynamically allocated. but that's not the case in C++.
There are much more, I guess that;s enough for now..
But Java evolves from C++, so, people who'd been program in Java shouldn't have difficulties writing a Java program. The syntax is kinda same.(although not really)

Actually, I don;t have to write any tutorials because they;re tons of tutorials out there in the cyberspace.Here, I give you the official Java website.

http://java.sun.com
For those who've never learn Java, that;s your homework, please go through the tutorial in that official Java website. Tomorrow, we;ll review the history of Java before we write, compile and run the program.

babai and have fun!
masterof_none is offline   Reply With Quote
masterof_none
Administrator
Administrator
 
Join Date: Apr 2003
Posts: 834
  #2 Old 20-05-2003 Default pointers in Java

oops,I've made a mistake on the last posting.

there;s no pointers in Java but only references. pointers is the variable that store the memory and when it get dereference, it would give the value of the variable at that memory.

//you may review C++ first.

e.g

int blah = 89;
int *blah2; //see, the star

blah2 = &blah //get the memory location

so,

//this is C++
cout<< "this is blah"+*blah;

will print 89.

so, the difference between the reference and pointer, then, is the *,
pointer has that star (*), while reference not.

reference can be created like this;

//C++

int blahblah = new int;

blahblah now is a reference to a memory allocated on the fly for int,
but the memory is not yet allocated,....
so, to initialize blahblah,

blahblah = 90; // initialize, memory get allocated

cout<<"blahblah is "+ blahblah;

will print 90.

as we all know from the previous post, Java syntax evolves from the C++,
from example, above, the difference is just how to print.
in java, there is one long syntax for that,

System.out.println("I'm "+blahblah+"th RC memeber");

will print , I'm the 90th RC member.

as I hope at the end of this summer.

When I first time learn abt pointers and reference, it's so confusing,,
that I think I better quit programming. But as you can see, thank God and thanks to friends, I'm now a happy programmer.

Why happy?..because I like to see my program working.
masterof_none is offline   Reply With Quote
masterof_none
Administrator
Administrator
 
Join Date: Apr 2003
Posts: 834
  #3 Old 21-05-2003 Default allocation of memory

for those who never program, or forgot how to,
you may not want to see this.
you may want to read the history of Java first.

.................................................. .............................

memory allocation is the mother of bugs.

so, what I've done on the last post:

int blah = new int;

while this is short, we must understand why we did this.
this is the sort cut of :

int blah; // initialize only , no memory allocated yet.

blah = new int; //allocate memory.

now, blah is the reference, so...to be safe, always initialize new variable
with zero;

blah = 0;

so, in the last posting, I;m not quite right by saying

int blah = new int;

as 'no allocation of memory yet.
We'll talk more abt memory allocation when we get there in the series of postings.
masterof_none is offline   Reply With Quote
bachok83 Male
Sleepin' G33k
Administrator
 
bachok83's Avatar
 
Join Date: Apr 2003
Posts: 221
  #4 Old 21-05-2003 Default

you may want to write what is cout what is int...because to some people it may be so confusing...

nevermind, here it is
the int is integer. So you kinda declare that "blah" is your integer. So computer will understand that. Then, you declare the value for blah
let say you put this

Code:
int blah = 90;
note that you must put ; or we call is colon, to end syntax just like what i've show above.

cout is to print out everything you want to print on your screen. For example, you wanna print Hello World on your screen using C++, you may want to write this

Code:
cout>>"Hello World";
i suppose this slot is for Java, as i'm also learning Java. So we just stop here for C++.
Good Luck guys......
bachok83 is offline   Reply With Quote
littlebigone Male
Slightly Senior Member
 
Join Date: Apr 2003
Posts: 867
  #5 Old 20-09-2003 Default

just looking at the old posts and saw this mistake.

cout << "Hello World";
littlebigone is offline   Reply With Quote
bachok83 Male
Sleepin' G33k
Administrator
 
bachok83's Avatar
 
Join Date: Apr 2003
Posts: 221
  #6 Old 20-09-2003 Default

hahaha my bad...

sorry for that silly mistake..
__________________
~~
Looking for cars : http://www.wemotor.com

bachok83 is offline   Reply With Quote
masterof_none
Administrator
Administrator
 
Join Date: Apr 2003
Posts: 834
  #7 Old 20-09-2003 Default

I have to admit that I'm a Java fan. But half way through the tutorial, I don't think I'm fit enough to keep on posting . So, I decided to back up and play more with it. Now, I try to open a project site based on Java..and will be available shortly...and I think it's wiser for us to collect bunch of tutorials out there and put it in one place...and help each other understanding it...and..if we have time, we can do write some stuff just want to see how it works.
masterof_none is offline   Reply With Quote
littlebigone Male
Slightly Senior Member
 
Join Date: Apr 2003
Posts: 867
  #8 Old 20-09-2003 Default

Speaking of tutorials, this is the tutorial I used to learn C++.

http://www.cplusplus.com/doc/tutorial/

Don't think it is meant for people with no programming experience but if you know Java or C and want to learn C++, this should get you through.

But the best thing always is of course, practice.
littlebigone is offline   Reply With Quote
chenchow Male
ReComer
Administrator
 
chenchow's Avatar
 
Join Date: Apr 2003
Posts: 4,989
  #9 Old 20-09-2003 Default

talking about programming, anyone has any idea of how tough or how easy Python is?
chenchow is offline   Reply With Quote
masterof_none
Administrator
Administrator
 
Join Date: Apr 2003
Posts: 834
  #10 Old 20-09-2003 Default

I heard it's an Object oriented but it's more like Perl. kinda like script language
masterof_none is offline   Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT +8. The time now is 07:23 PM.


Powered by vBulletin® Version 3.7.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

ReCom stands for Reborn Community. It has no affiliation with other organizations that may share the same name. The views expressed in this website solely represent the authors point of view and do not necessarily reflect the views of ReCom Anchors and other ReCom users.


 

Page generated in 0.22825 seconds with 13 queries