469,341 Members | 7,121 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,341 developers. It's quick & easy.

Köll & Sam Classroom Blog

Dököll
2,364 Expert 2GB
Hello Dudes and Dudettes!

I am excited to announce I am embarking on a new Journey, JAVA baby. This is a new arena for me, hope I survive and able to muscle through it.

Will post articles within three months from now.

Wish me luck!

Köll
Sep 5 '07
216 12244
Dököll
2,364 Expert 2GB
All is elementary with us, our prof. is pretty big on starting us off slow. The big idea thus far is being able to use the book and modify code, to be able to look at a bit of code and make it do whatever you like. One of the most interesting point she made last week was there are a number of ways to find out an answer, that be the reason why lately I have been sticking my nose in it see what it'll do...get used to thinking outside of the box...

Judging by that bit of code posted Sammy, I'll say you're pretty advanced, we are going to need to render a full application at the end of the semester, our "gentle" professor may have something up her sleeves near the end:-) But so far so good!
Oct 7 '07 #51
SammyB
807 Expert 512MB
Judging by that bit of code posted Sammy, I'll say you're pretty advanced,,,
Definitely not advanced: there are just many different ways of learning Java and many different aspects of Java that you can learn, But, check out my Java puzzle thread, http://www.thescripts.com/forum/thread719618.html
It's only 5 lines, but it has rocked my world. In the good old days, you could count on 1=1, but no longer, it seems!
Oct 7 '07 #52
Ganon11
3,652 Expert 2GB
Already threw you an answer on that one, Sammy. Welcome to Java :D.
Oct 7 '07 #53
SammyB
807 Expert 512MB
Already threw you an answer on that one, Sammy. Welcome to Java :D.
Yep, that helped a bunch. I'm ready to create a child class called string with parent class String that overloads ==

Here's a harder question: using Scanner.nextInt, I figured I could catch InputMismatchException if the user entered invalid characters, but typing a letter caused chaos! I fixed it by using nextLine method instead, but was dissatisfied. Maybe if I use the nextInt(radix) form, it would work, but I'm way too rusty on regex. It would be nice if Sun included some examples! Is there better documantation than http://java.sun.com/j2se/1.5.0/docs/...io.InputStream) ?
Oct 8 '07 #54
Ganon11
3,652 Expert 2GB
Here is your answer.

Also, I don't think you can overload operators in Java like you can in C++, you're stuck with the .equals() method.
Oct 8 '07 #55
r035198x
13,262 8TB
Here is your answer.

Also, I don't think you can overload operators in Java like you can in C++, you're stuck with the .equals() method.
Yep, we don't have such nonsense in Java. The operators are well defined for all the types of operands they operate on.
You can use .equals and compareTo methods for comparisons.
You then have the beautiful option of creating a method for any other operator you wish to mimick.
Oct 8 '07 #56
SammyB
807 Expert 512MB
...operators are well defined for all the types of operands they operate on...
Not for String! ;D
Oct 8 '07 #57
r035198x
13,262 8TB
Not for String! ;D (I hate the message too short.)
Well, + is the only operator (besides instanceof) defined for strings and is well defined for it.

Edit: You can get away with posting less than 20 characters. Just include a sufficient amount of spaces between two words.
Oct 8 '07 #58
JosAH
11,448 Expert 8TB
Well, + is the only operator (besides instanceof) defined for strings and is well defined for it.
Don't forget '=' and '==' and '!=' and '+='; only the last one is special to Strings
again. And yes, they're all well defined again (check the JLS) ;-)

kind regards,

Jos
Oct 8 '07 #59
SammyB
807 Expert 512MB
Well, + is the only operator (besides instanceof) defined for strings and is well defined for it.
He just means that the rest are not so well defined! ;o(>>>
Oct 8 '07 #60
r035198x
13,262 8TB
He just means that the rest are not so well defined! ;o(>>>
Come on man give the language a break.
Oct 9 '07 #61
JosAH
11,448 Expert 8TB
Come on man give the language a break.
I think Sam still struggles a bit with definitions that are not the ones he ever
saw before in other programming languages or were not so 'exposed' or 'explicit'
in say, C++ as they are in Java.

btw, IMHO it does help if one has gone the path C --> C++ --> Java and maybe
a bit of Objective C after the C step and before the C++ step.

kind regards,

Jos

ps. @Sam: try to find James Gosling's "The Java Programming Language",
it's a must read.
Oct 9 '07 #62
SammyB
807 Expert 512MB
I think Sam still struggles a bit with definitions that are not the ones he ever
saw before in other programming languages or were not so 'exposed' or 'explicit'
in say, C++ as they are in Java.

btw, IMHO it does help if one has gone the path C --> C++ --> Java and maybe
a bit of Objective C after the C step and before the C++ step.

kind regards,

Jos

ps. @Sam: try to find James Gosling's "The Java Programming Language",
it's a must read.
Not really struggling ... 97 average ;oD
The book is a little frustrating: I'd like more of a reference book, so, for example, when they introduced strings, they should have mentioned not to do == instead of waiting until chapter 9
> one has gone the path
my problem exactly, my path:
wires (analog computing) => Fortran => Assembly => PL1 => VBA => C++ => VB => C# => Java
Most eveything I write these days is C#, so the easiest way for me to learn is to compare and contrast C# and Java.

Anyway, my ragging is just my weird humor: I really appreciate eveyone's help and will look for the book. Taking a break this afternoon: have a new toy: an off-road Mt. bicycle and will be trying it out here! May have to sleep through class afterwards! Have a great day, eveyone! --Sam
Oct 9 '07 #63
NeoPa
32,182 Expert Mod 16PB
...
Taking a break this afternoon: have a new toy: an off-road Mt. bicycle and will be trying it out here! May have to sleep through class afterwards! Have a great day, eveyone! --Sam
Very nice Sammy.
Oct 9 '07 #64
Motoma
3,237 Expert 2GB
Hello Dudes and Dudettes!

I am excited to announce I am embarking on a new Journey, JAVA baby. This is a new arena for me, hope I survive and able to muscle through it.

Will post articles within three months from now.

Wish me luck!

Köll
Terror of terrors! Horror of horrors! Quit now while you still have your wits!
Oct 9 '07 #65
Dököll
2,364 Expert 2GB
Terror of terrors! Horror of horrors! Quit now while you still have your wits!
Your timing is impecable, what fun it was during the first exam, what a stinker...Open book ladies and gentlemen. My lab partner went forward complaining she was feeling sick, at first I thought she was faking, but looking at her, her face was all weird.

I was actually going to break up our alliance because I feel I work best when I can sit down and think. She'll need my help...Perhaps we can think seperately and communicate our findings later, I don't know something in that king of a line, but I do need to think alone. At least we can together battle this beast, somehow; my friends, this language does not play:-)

The professor, nice person, but she is doing her job, she is not giving it away, when she said you have five minutes...

...hopelessness galore. Took a quick look at my poorly written and modified code, and shook my head. All I had to do was again MODIFY code, pretty simple yes! No, not here...

Shaking my head as I communicate this you, so far the only thing to be proud of is Lab 5, and that's because I had two weeks to do it, will post the finished project momentarily. All of my other ones I have to redo, and here comes the niceness of our professor shinning through. Though she will not give it away, she does give a boost. I'll redo them!

Fine, I thought, know what mean, language don't want to play nicely, I'll just be patient, ffind my way into its head, then one day I will laugh, and laugh, and laugh:o) But for now, I redo the work and see what happens, I'll jus redo it. Can't rain all the time, right!
Oct 13 '07 #66
Dököll
2,364 Expert 2GB
Here is Lab 5, still modified code, but I like to run it, because it works, to my standards anyway:

http://www.thescripts.com/forum/show...54#post2876254

You're right by the way Sam, truly strange stuff there "s != "1"" What gives!
Oct 13 '07 #67
JosAH
11,448 Expert 8TB
You're right by the way Sam, truly strange stuff there "s != "1"" What gives!
It isn't strange stuff; it's not what it is in Basic or whatever other languages that
use the '==' operator overloaded for string values. The == operator in Java just
compares the pointers to the actual object values or in case of primitives it
compares the values themselves. In C++ the 'string' class overloads the '=='
operator for exactly this reason; it all happens behind your back so you won't
notice it (as in Basic or whatever). Java doesn't do anything behind your back
and didn't overload the '==' operator either so you're still capable and alllowed
to compare two pointers. Java is like C in that respect: simple and nothing
opaque running behind your back.

btw, "1" == "1" is true but for different reasons. In C++ the following will return
false for dynamic objects as well:

Expand|Select|Wrap|Line Numbers
  1. string* s1= new string("1");
  2. string* s2= new string("1");
  3. if (s1 == s2) ... // false;
  4.  
kind regards,

Jos
Oct 13 '07 #68
NeoPa
32,182 Expert Mod 16PB
...
You're right by the way Sam, truly strange stuff there "s != "1"" What gives!
I think Jos has explained exactly why, when learning a new language (or anything really) one has to try to think in the way of that subject rather than expect that new subject to conform to one's own way of thinking. This is one of the main reasons why so many people find it hard to learn new things.
We get many questions in the Access section wondering why Access works in such a "silly" way. The answer is invariably to explain that Access is actually making perfect sense for very good reasons. Because the OP doesn't generally understand why, they think IT is wrong.
Oct 13 '07 #69
Dököll
2,364 Expert 2GB
It isn't strange stuff; it's not what it is in Basic or whatever other languages that
use the '==' operator overloaded for string values. The == operator in Java just
compares the pointers to the actual object values or in case of primitives it
compares the values themselves. In C++ the 'string' class overloads the '=='
operator for exactly this reason; it all happens behind your back so you won't
notice it (as in Basic or whatever). Java doesn't do anything behind your back
and didn't overload the '==' operator either so you're still capable and alllowed
to compare two pointers. Java is like C in that respect: simple and nothing
opaque running behind your back.

btw, "1" == "1" is true but for different reasons. In C++ the following will return
false for dynamic objects as well:

Expand|Select|Wrap|Line Numbers
  1. string* s1= new string("1");
  2. string* s2= new string("1");
  3. if (s1 == s2) ... // false;
  4.  
kind regards,

Jos
Java is like C, I'll need to remember that, perhaps read my old C book, grab the ones that worked. Are you saying though Java is not doing what JavaScript does with a statement as If this and that == "Lalala" Then do whatever when I see the == operator?

This:

Expand|Select|Wrap|Line Numbers
  1. Var s1="1";
  2. Var s2="1";
  3. if (s1 == s2) ... // true;
  4.  
Poorly written code, but when you make a paaword form, if s1 == s2, user moves on. What is Java doing, I think I get it, hopefully I understand what is said, but it sounds like you are saying Java would look at a pointer in this case and not the actual object!
Oct 14 '07 #70
Dököll
2,364 Expert 2GB
I think Jos has explained exactly why, when learning a new language (or anything really) one has to try to think in the way of that subject rather than expect that new subject to conform to one's own way of thinking. This is one of the main reasons why so many people find it hard to learn new things.
We get many questions in the Access section wondering why Access works in such a "silly" way. The answer is invariably to explain that Access is actually making perfect sense for very good reasons. Because the OP doesn't generally understand why, they think IT is wrong.
I can't believe I missed this post, but that indeed, I took a second look...Looks like I am winning...just wrote to JosAH...

Good point by the way, I also think a lot goes on that folks do not understand, they should just go with the flow. You'll find though, I tend to complain about it, but all in good nature. I think in turn, there will be a light a the end of the tunnel;-) so yeah it's good to be patient with things...
Oct 16 '07 #71
SammyB
807 Expert 512MB
... there will be a light a the end of the tunnel...
That's the train's beacon!
Oct 17 '07 #72
JosAH
11,448 Expert 8TB
Shouldn't this thread just be moved to the Java forum? It's all about Java and
there's no need to keep this "our little secret" is there?

kind regards,

Jos
Oct 17 '07 #73
r035198x
13,262 8TB
Shouldn't this thread just be moved to the Java forum? It's all about Java and
there's no need to keep this "our little secret" is there?

kind regards,

Jos
I've thought about this many times as well.
Might have wait to see if Dok agrees to it though.

Edit: The titles are now appearing in bigger font or am I just sleepy?
Oct 17 '07 #74
JosAH
11,448 Expert 8TB
I've thought about this many times as well.
Might have wait to see if Dok agrees to it though.

Edit: The titles are now appearing in bigger font or am I just sleepy?
Who's Dok anyways?

Jos (<--- where's my bed? gootchy, gootchy, gootchy, bed where are you? ;-)
Oct 17 '07 #75
r035198x
13,262 8TB
Who's Dok anyways?

Jos (<--- where's my bed? gootchy, gootchy, gootchy, bed where are you? ;-)
O P
Oct 17 '07 #76
Dököll
2,364 Expert 2GB
I don't see why not!
Oct 18 '07 #77
SammyB
807 Expert 512MB
Well, the term is over and I survived with a 102.66% average!D You're got to love extra credit: never helps the poor student because they do not have time to do the extra work! Anyway, many thanks to Jos, Gannon and r0 for information support and the rest of you for the encouragement. I'll have harder questions next term, but I'm going to get a headstart tonight. Next chapter is files; finally will have some data to work with. Now, if the weather would just get warm for one more bike ride before the snow!
Nov 27 '07 #78
dav3
94
congrats on an outstanding mark!
Nov 27 '07 #79
Ganon11
3,652 Expert 2GB
Well, the term is over and I survived with a 102.66% average!D You're got to love extra credit: never helps the poor student because they do not have time to do the extra work! Anyway, many thanks to Jos, Gannon and r0 for information support and the rest of you for the encouragement. I'll have harder questions next term, but I'm going to get a headstart tonight. Next chapter is files; finally will have some data to work with. Now, if the weather would just get warm for one more bike ride before the snow!
Only a 102.66%? Really, I'm disappointed in you. :-P

Congrats, and bring it on! Everyone is ready to help you out (but only if you read those posting guidelines! XD)
Nov 27 '07 #80
r035198x
13,262 8TB
Well, the term is over and I survived with a 102.66% average!D You're got to love extra credit: never helps the poor student because they do not have time to do the extra work! Anyway, many thanks to Jos, Gannon and r0 for information support and the rest of you for the encouragement. I'll have harder questions next term, but I'm going to get a headstart tonight. Next chapter is files; finally will have some data to work with. Now, if the weather would just get warm for one more bike ride before the snow!
I hope you now have the whole Sun Java tutorial on your computer together with the API specs for all the standard Java classes/interface.
Nov 27 '07 #81
JosAH
11,448 Expert 8TB
@Sam: well done, congrats. Java's IO package is extremely well implemented;
you just have to figure out it's 'structure', i.e. the entire thing is based on the
decorator pattern; as soon as you recognize that you can do wonders with it.

kind regards,

Jos
Nov 27 '07 #82
heat84
118 100+
Hello Dudes and Dudettes!

I am excited to announce I am embarking on a new Journey, JAVA baby. This is a new arena for me, hope I survive and able to muscle through it.

Will post articles within three months from now.

Wish me luck!

Köll
Wish you the best dude/dudette
Nov 27 '07 #83
Dököll
2,364 Expert 2GB
Well, the term is over and I survived with a 102.66% average!D You're got to love extra credit: never helps the poor student because they do not have time to do the extra work! Anyway, many thanks to Jos, Gannon and r0 for information support and the rest of you for the encouragement. I'll have harder questions next term, but I'm going to get a headstart tonight. Next chapter is files; finally will have some data to work with. Now, if the weather would just get warm for one more bike ride before the snow!
Sooweet!

Good job, Sammy...

I am almost there. Will definitely pass but I can't be quick to say with such high marks, well done Sammy!

We end sessions next week near me. Will let you know:-)
Dec 1 '07 #84
hsn
237 100+
GOOD LUCK
you will love it
Dec 1 '07 #85
During my "Object Oriented Programming" class,last year,my professor adopted
"Core Java" from Cay Horstmann and he even made his lesson slides upon that book.
I have to say that is a very clear and concise book with all the key java features and technicalities explained through many examples.
who agrees?
Dec 1 '07 #86
Dököll
2,364 Expert 2GB
GOOD LUCK
you will love it
Many thanks, hsn!

I think I am loving it. Actually came on here to report I have just revamped a Lab I was boasting about scoring fairly comfortable points in. Looks like something clicked into place, I can read the language differently. Not quick to say, I'll master all of it anytime soon, but I think I am definitly getting the basics.

Last exam is this Wednesday, 12th, December. I will know then if I should take it again so I get or move on to next level. Again, wish me luck:-)

Have a look at my first Article. Before you do, please DO NOT USE the following links, they're dead:

http://www.thescripts.com/forum/thread746802.html

http://www.thescripts.com/forum/thread746809.html

I am hoping to get them removed. An attempt to fix seems to take.

USE THIS LINK

Cohesion of methods and classes...(Game class 1)
http://www.thescripts.com/forum/thread746848.html

And the relating classes:

Cohesion of methods and classes (Command class)...

Cohesion of methods and classes (CommandWords class)...

Cohesion of methods and classes (Eat class)...

Cohesion of methods and classes (Food class)...

Cohesion of methods and classes (Parser class)...

Cohesion of methods and classes (Room class)...

Cohesion of methods and classes (View class)...

In a bit!

Dököll
Dec 10 '07 #87
BigDaddyLH
1,216 Expert 1GB
During my "Object Oriented Programming" class,last year,my professor adopted
"Core Java" from Cay Horstmann and he even made his lesson slides upon that book.
I have to say that is a very clear and concise book with all the key java features and technicalities explained through many examples.
who agrees?
I've been programming, and programming in Java for so long that it's hard for me to judge intro text books. I hope that doesn't sound like bragging, but I'm just saying my viewpoint is different. Anyhowdy, I've seen a number of positive reviews of "Head First Java":

http://www.oreilly.com/catalog/hfjava2/

The format drives me nuts -- wacky graphics with thought bubbles, but I can see the points they're making. I could also see why a professor may be too self-conscious to use it as a textbook, as well.

You may be happy with your assigned textbook, but have you looked at any others? Comments?
Dec 10 '07 #88
Dököll
2,364 Expert 2GB
During my "Object Oriented Programming" class,last year,my professor adopted
"Core Java" from Cay Horstmann and he even made his lesson slides upon that book.
I have to say that is a very clear and concise book with all the key java features and technicalities explained through many examples.
who agrees?
Hiya, MarshMallow!

The book I am using seems to do wonders, at least now it seems to make sense, was just a book before:

Michael Kölling and David J Barnes "Object Frst With Java" 3rd edition.

A number of references were made through this thread specific to other books,sites and so on. Have a look. Good luck in your projects:-)

Dököll
Dec 11 '07 #89
Dököll
2,364 Expert 2GB
Many thanks, hsn!

I think I am loving it. Actually came on here to report I have just revamped a Lab I was boasting about scoring fairly comfortable points in. Looks like something clicked into place, I can read the language differently. Not quick to say, I'll master all of it anytime soon, but I think I am definitly getting the basics.

Last exam is this Wednesday, 12th, December. I will know then if I should take it again so I get or move on to next level. Again, wish me luck:-)

Have a look at my first Article.

USE THESE LINKS: Previous ones fixed by someone truly nice, I'll soon find out

Cohesion of methods and classes...(Game class)
http://www.thescripts.com/forum/thread746809.html

And the relating classes:

Cohesion of methods and classes (Command class)...
http://www.thescripts.com/forum/thread746811.html

Cohesion of methods and classes (CommandWords class)...
http://www.thescripts.com/forum/thread746812.html

Cohesion of methods and classes (Parser class)...
http://www.thescripts.com/forum/thread746813.html

Cohesion of methods and classes (Room class)...
http://www.thescripts.com/forum/thread746814.html

Cohesion of methods and classes (Food class)...
http://www.thescripts.com/forum/thread746817.html

Cohesion of methods and classes (View class)...
http://www.thescripts.com/forum/thread746819.html

Cohesion of methods and classes (Eat class)...
http://www.thescripts.com/forum/thread746821.html

In a bit!

Dököll
There, looks cleaner now, anyone should be able to get to each link properly. Thanks much for helping make this happen:-)

Dököll
Dec 11 '07 #90
Welcome man you are joining a really vast community
Dec 11 '07 #91
primeSo
35
I will start to learn JAVA on the coming January! yeah ..JAVA here i come ^.^
Dec 12 '07 #92
BigDaddyLH
1,216 Expert 1GB
I will start to learn JAVA on the coming January! yeah ..JAVA here i come ^.^
Lesson 1: Java is not an acronym, so it's not written JAVA ;-)
Dec 12 '07 #93
SammyB
807 Expert 512MB
Lesson 1: Java is not an acronym, so it's not written JAVA ;-)
Wow, you sound just like Jos! But, actually JAVA is an acronym!
See Jamming Amplitude Versus Azimuth :D Sam
Dec 13 '07 #94
BigDaddyLH
1,216 Expert 1GB
Wow, you sound just like Jos! But, actually JAVA is an acronym!
See Jamming Amplitude Versus Azimuth :D Sam
I stand corrected. I suppose I should buy everyone a round of Grolsch, then?
Dec 13 '07 #95
Dököll
2,364 Expert 2GB
I stand corrected. I suppose I should buy everyone a round of Grolsch, then?
Hey, that's great beer, fancy bottle, here's to ya:-)




Re: My First Java Course: Wish me luck:-)
--------------------------------------------------------------------------------

Welcome man you are joining a really vast community

--------------------------------------------------------------------------------
Thanks, it looks like it is a vast community:-)


Re: My First Java Course: Wish me luck:-)
--------------------------------------------------------------------------------

I will start to learn JAVA on the coming January! yeah ..JAVA here i come ^.^

--------------------------------------------------------------------------------
Good luck to you, three months ago, I had no clue, now I am starting to get my feet wet. Don't give up even it Java eats you alive;-)


Hello Sam, hey gang!

I was coming over to let you all know tonight was my last class, Exam 3, the Final. I got everything answered, whether I answered correcly is another matter. Code worked for everything nonetheless, also not in the same manner it was designed to be received by the professor, but nothing was left undone.

I should be excited here but I am not, (too supersticious) had my notebook with me the whole time "pipe screen saver".

...I want to hear how poorly or well I did first.

For now, I consider moving to next level. An additional course in Java is probably next semester. I did register for Linux, but I think, I'll stay with Java a little so I do not lose touch, if the Spring session adds it to the curriculum.

Good luck to all of you:-)
Dec 13 '07 #96
primeSo
35
Lesson 1: Java is not an acronym, so it's not written JAVA ;-)
@@ oh....thanks. : )

Good luck to you, three months ago, I had no clue, now I am starting to get my feet wet. Don't give up even it Java eats you alive;-)
haha, sure. Good luck and cheers ~~ : )
Dec 26 '07 #97
Dököll
2,364 Expert 2GB
This just in: I scored a 90 in my last exam, Yahoooooooo!!!!!

Hey now I can talk, scored 48 for my first 65 for my second, but went I started truly getting my labs down I knew the final would be different, it's exciting:-)

Still wish me luck, I take on level 2 two weeks from now...
Jan 6 '08 #98
Dököll
2,364 Expert 2GB
@@ oh....thanks. : )



haha, sure. Good luck and cheers ~~ : )
Thanks, primeSo, have a great week-end!
Jan 6 '08 #99
SammyB
807 Expert 512MB
This just in: I scored a 90 in my last exam, Yahoooooooo!!!!!

Still wish me luck, I take on level 2 two weeks from now...
That's great! Hopefully, she will give lots of grace and throw out the early grades. It was easier for me since I work with C# every day, so I knew what to expect. With just your VB background, it was like learning Chinese after only knowing Spanish. Now, spend that two weeks reading ahead and doing the next two chapter's homework! --Sam
Jan 6 '08 #100

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Rich Wallace | last post: by
3 posts views Thread by Tony | last post: by
71 posts views Thread by iesvs | last post: by
reply views Thread by delhi institute of management & services | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by Purva khokhar | last post: by
1 post views Thread by haryvincent176 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.