JAVA LESSON+1.0.0.5

ravicplk

Member
Oct 18, 2007
4,120
1
0
39
Sri Lanka
Hello there. Ravi here with the java lesson. I hope that u installed jdk properly and configured it correctly. So no more further talks, let’s move on to the today’s lesson.

So today we are going to write simple java application. (not simple it is the simplest)
Anyway first step…..open notepad and type the following things in that..(sooo u are copying neeee…ok ok..copy it properly)


/*This is a simple java program.
Save this file as hello.java
*/
class hello
{
public static void main(String args[])
{
System.out.println("Ayubowan Elakiri");
}
}


Ok. I hope that u have typed it correctly. Then u have to save this file as hello.java.
How to do it?? Go to File menu > save as> and then u will get a familiar dialogue box.
Heeeey can u see a place for name u r document. For the name u have to type hello.java.

Hmmmmmmmm…where should u save it..save it in C:\. Ok finished.

Now go to command prompt. (run>cmd) then u will see something like this


47037212mw1.jpg


then u have to change the directory to where u saved u r hello.java file.
so we have to move to c:\ (if u are in c:\ no problem)
to move to c:\. Type cd\ and hit ENTER.

28579698tx1.jpg


ok nedaaaaaaaaaaaa!...now type javac hello.java and press ENTER.

10si0.jpg


Then u will notice that something is going on..no worries after sometime u will see the dir move to c:\ again.

ok.now u have compiled u r java source file. now u are going to run u r first application..before that set the classpath( i will explain abt these things in future lessons)to c:\


in command prompt type
set classpath=c:\ and hit ENTER.

11nx9.jpg


uuuuuuuhoooooooooooooooooooooooo......now we are going to run the application...heeee heeeeeeee...
ok..as u are back in c:\ in the command prompt. type java hello

12sq0.jpg


AND HIT ENTER

soooooooooooooooo what u got!!!!!!!!!!!!!!!!!!!!!!!
if u followed the steps correctly u will get following result.

13xg1.jpg


so. how u feel after running u r first java program..:D :D :D
he heeeee when i was doing my first java program i faced up to awful lot of problems...ketiyen kiwwoth JAVA epaaaaaaaaaaa unaaa...he heeee but nevertheless u learn by experience neeee....so if u face to any problems when doing this post u r problems here.....
bye and c yaaaaaaa..
ps-running the first program always gives u a great feeling.
 

heshan123

Member
Jan 12, 2007
3,422
3
0
40
SrI lAnKa
ravicplk said:
he heeeeee..u are a software engineer neeee..so how u felt when u first run this.
cha max machan.

"'javac' is not recognized as an internal or external command,
operable program or batch file."

this is all i got. After about 2 weeks i figured out that i need to set the path.
:lol: :lol:
 

ravicplk

Member
Oct 18, 2007
4,120
1
0
39
Sri Lanka
heshan123 said:
cha max machan.

"'javac' is not recognized as an internal or external command,
operable program or batch file."

this is all i got. After about 2 weeks i figured out that i need to set the path.
:lol: :lol:
he heeeeeeee i faced to that thing toooooo
 

heshan123

Member
Jan 12, 2007
3,422
3
0
40
SrI lAnKa
ravicplk said:
he heeeeeeee i faced to that thing toooooo
i almost gave up programming within those two weeks. After that a friend of mine at the uni told me, u have to set the path.
However after learning java, learning other stuff were easy.
 

ravicplk

Member
Oct 18, 2007
4,120
1
0
39
Sri Lanka
heshan123 said:
i almost gave up programming within those two weeks. After that a friend of mine at the uni told me, u have to set the path.
However after learning java, learning other stuff were easy.
yaaaaaaaa...i am learning it these days..and like to share what i learnt with others..anyway what u think abt my lessons..this one and previous ones.
 

heshan123

Member
Jan 12, 2007
3,422
3
0
40
SrI lAnKa
ravicplk said:
yaaaaaaaa...i am learning it these days..and like to share what i learnt with others..anyway what u think abt my lessons..this one and previous ones.
gr8 machan. I like ur style. This is a gr8 way to learn for a beginner. Coz if u encounter problems during program execution(which is so damn obvious) you can solve it by discussing with others. Plus as i said java is a very good starting point for a programmer. So i think ur doing a gr8 job. :yes: :yes: :yes: :yes:
 

ravicplk

Member
Oct 18, 2007
4,120
1
0
39
Sri Lanka
heshan123 said:
gr8 machan. I like ur style. This is a gr8 way to learn for a beginner. Coz if u encounter problems during program execution(which is so damn obvious) you can solve it by discussing with others. Plus as i said java is a very good starting point for a programmer. So i think ur doing a gr8 job. :yes: :yes: :yes: :yes:
thankssssssssssssss
 

heshan123

Member
Jan 12, 2007
3,422
3
0
40
SrI lAnKa
ravicplk said:
thankssssssssssssss
ur welcome machan. get into C programming as soon as possible. Coz there are many many java programmers in the market (thanks to SCJP i think). but very few C or C++ programmers. One thing is those languages are kind of low level languages and its tough to program. Anyway I think we should concentrate more on C and C++. There is a growing market for those programmers.
 

nagaya

Member
Mar 18, 2007
12,671
194
0
isn't C programer can port into java easyly,
how be a good C/C++/Java programmer
does we use Delphi now or it's a dead language?
 

ravicplk

Member
Oct 18, 2007
4,120
1
0
39
Sri Lanka
heshan123 said:
ur welcome machan. get into C programming as soon as possible. Coz there are many many java programmers in the market (thanks to SCJP i think). but very few C or C++ programmers. One thing is those languages are kind of low level languages and its tough to program. Anyway I think we should concentrate more on C and C++. There is a growing market for those programmers.
thankssss ayya for u r advice..definitely i will do c and c++.thanks again
 

heshan123

Member
Jan 12, 2007
3,422
3
0
40
SrI lAnKa
nagaya said:
isn't C programer can port into java easyly,
how be a good C/C++/Java programmer
does we use Delphi now or it's a dead language?

The best way to become a good programmer is to start with something easy. I think Java is the best for that. If you jump into C first you might find it a bit confusing (Unless of course ur kind of brainy). Coz in C there arnt many safe programming procedures like Java. For example take out of bound exceptions in java. There are none like that in C. So programmers are easily mis-lead (meaning its easy make errors in C programming than Java). Also there is no automatic garbage collection in C. I can go on for ever saying that java is easier than C like this. The bottom line is u have start with something easy.

Delphi is a very good but almost dead language. However the Famous KMPlayer is written in Delphi. I think its easier to work with media codecs when using Delphi.
 

heshan123

Member
Jan 12, 2007
3,422
3
0
40
SrI lAnKa
ravicplk said:
thankssss ayya for u r advice..definitely i will do c and c++.thanks again
ela ela. But dont do it just coz i ask you to do. There are so many paths in programming we can follow. For example I find myself better in web programming (languages like PHP, JavaScripts, JSP etc) than system programming stuff. So its upto u to find which way is best for you and build on that. Even the .Net framework is quite interesting. I went through it recently and learnt a ton.
 

ravicplk

Member
Oct 18, 2007
4,120
1
0
39
Sri Lanka
heshan123 said:
ela ela. But dont do it just coz i ask you to do. There are so many paths in programming we can follow. For example I find myself better in web programming (languages like PHP, JavaScripts, JSP etc) than system programming stuff. So its upto u to find which way is best for you and build on that. Even the .Net framework is quite interesting. I went through it recently and learnt a ton.
ok,great..let seeeee.:D
 

nagaya

Member
Mar 18, 2007
12,671
194
0
heshan123 said:
The best way to become a good programmer is to start with something easy. I think Java is the best for that. If you jump into C first you might find it a bit confusing (Unless of course ur kind of brainy). Coz in C there arnt many safe programming procedures like Java. For example take out of bound exceptions in java. There are none like that in C. So programmers are easily mis-lead (meaning its easy make errors in C programming than Java). Also there is no automatic garbage collection in C. I can go on for ever saying that java is easier than C like this. The bottom line is u have start with something easy.

Delphi is a very good but almost dead language. However the Famous KMPlayer is written in Delphi. I think its easier to work with media codecs when using Delphi.

thanks aiya;how can we learn programming?self studying or at any institute?what about oppertunities?i've done Basic,Pascal,VB when i was a kid;After AL how can we become a good programmer?should we work for a company or do it own self?
i heard something called Virtusa is a great place