But, since you use Eclipse on a daily basis, a couple of questions. As part of each chapter, we develop the sample application as an Applet. The book is assuming that you are using TextPad and gives you a three line Html program which not only calls the Applet, but also specifies the height & width. With Eclipse, I have not created the html document; I just use the menu: Run > Run As > Java Applet, which works OK, but I have to resize the Applet. How do you add the html doc to your project and run it instead of using the Run As command.
Can you run the AppletViewer as an 'external tool'? (last option in the 'Run' menu);
Originally posted by SammyB
Second, it is annoying to have to press both the tab key and the Enter key to use an intellisense suggestion. Can I change the preferences so that the tab key alone selects & uses the current line?
Thanks!
Huh? I never used 'intellisense' ever before; care to enlighten me? 'tab-enter'
simply replaces my selection with a tab and an enter (as it should?)
The most annoying problem was:
Insert parantheses, if necessary, to make the following statement correct
33 = 3*6-3+2+6*4-4/Math.pow(2,1)
Does she know how many different ways you could insert parens? Argh!
I don't consider that a Java question; nor do I think that pestering people with
applets is the way to go in studying Java. I'd expected a bit more OO theory
and its implementations using Java.
Huh? I never used 'intellisense' ever before; care to enlighten me? 'tab-enter'
simply replaces my selection with a tab and an enter (as it should?)
kind regards,
Jos
After you enter an object name and a period, you get a list of objects & methods. As you type, the list gets smaller as to match the characters that you type. Or, in the middle of typrin a long variable name, you can press <Ctrl><space> and you get a list of possible variables. This is called intellisense. You can arrow up & down, but to select an item, you must press <tab> and then <Enter>, or double-click on it.
I don't consider that a Java question; nor do I think that pestering people with
applets is the way to go in studying Java. I'd expected a bit more OO theory
and its implementations using Java.
kind regards,
Jos
In the early chapters, they develop the same project with and console app, a console app with swing, and an applet. That way, by the time you have done the same project three times, you have learned the java constructs presented in the chapter. So, chapter 2 was about assignment statments, chapter 3 was about math, and chapter 4 was about repitition.
After you enter an object name and a period, you get a list of objects & methods. As you type, the list gets smaller as to match the characters that you type. Or, in the middle of typrin a long variable name, you can press <Ctrl><space> and you get a list of possible variables. This is called intellisense. You can arrow up & down, but to select an item, you must press <tab> and then <Enter>, or double-click on it.
Ah, I'm with you again (silly, silly me); I just press <enter> when the selected method
or member is displayed. No need to do <tab> <enter>. Waidaminnit, I'll check
again ... <fiddle, diddle, fiddle, diddle/> nope, I just type "<type>." and then
a list of members (either methods or variables) pops up; I select one and then
press <enter>. If I press <escape> I'm back to normal editing again.
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!
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!
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 InputMismatchEx ception 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) ?
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.
Last edited by r035198x; Oct 8 '07, 05:13 PM.
Reason: cleaned it up a bit
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) ;-)
Comment