@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10



Comments:

<0> or the registry I suppose, but thats way beyond the Java scope and as such my personal interest at the moment.
<1> ryanstein: nextLine gives you a String, you can look at individual characters of that String.
<0> Bouncy: not all of 'm.
<2> Oh, so there's no way to just read the first character?
<1> ryanstein: What?
<0> ryanstein: sure, substring.
<3> or charAt(0)
<2> charAt(0) I tried that, but no luck.
<1> Why no luck?
<3> what did it return?
<2> cannot find symbol.
<1> BONG!
<0> ryanstein: make sure you typed and used it right.
<2> symbol : method nextCharAt(int)
<1> ryanstein: What are you trying to do?



<1> ryanstein: Java doesn't support a console, only a stream of input, which *YOUR OS* will normally deliver line-by-line, which is not Java's fault. jcurses does what you want, most likely.
<2> read a char, preferably an A or M, but I can figure that out later.
<0> still, if a method returns a String you should be able to use the String.charAt() method I would ***ume.
<2> transmission = input.nextCharAt(0);
<3> char transmission, will be null?
<3> nextCharAt?
<2> it's currently set to 0
<3> why not only charAt?
<4> because input isn't a string. It's (probably) an InputStream
<3> oh, thought someone said it was a String :)
<0> very likely.
<5> it seems to me that Scanner is considered to be the DataInputStream for console I/O by some...
<0> nextLine was said to return a string. I bet he replaced nextLine with charAt.
<0> thats not how it works, *if* nextLine returned a String you'd use input.nextLine().charAt(0);
<2> oh, that worked.
<5> but its api doc page rather seems to suggest that it is for reading specifically formatted input "only", not a "read anything that is technically possible automagically" functionality.
<4> what exactly *is* input?
<2> Scanner input = new Scanner(System.in);
<2> and my program's just crashed when it got to the char input part.
<5> a nextChar() would require what encoding is being used, too, i guess.
<4> yeah
<5> i wonder if scanner is worth the distraction, and wether it isn't better to go for the basic functionality yourself.
<4> there's nextByte(), but that's not necessarily going to be a character
<5> yeah
<2> This is an ***ignment for a java programming module of a course I'm doing, I don't know any other way of doing it.
<2> I'm only 8 weeks in.
<5> ryanstein: read a string, take it apart yourself, try to convert, if it fails, the input was invalid. else you'll have your value and can move on to the next step.
<2> ok.
<5> that's the bad thing about scanner, makes people invest time into figuring it out while not knowing the basics how to do what scanner does in the first place.
<2> Just thought scanner could do it all in one line, but if not, I'll have to do that.
<2> thanks.
<5> it should be a convenience cl*** for those in the knowing, not a way for beginners to avoid the inevitable.
<5> ryanstein: possibly related: http://javafaq.mine.nu/lookup?69
<4> you just described 75% of the API :)
<3> getting chestpains. could be bc ive been infront of my computer all day :P anyway, goodnight all
<5> Bouncy: uhm. go to the doc dude, honestly. :|
<3> nah, its ok.
<4> no, do go
<5> you don't want your heart to break down and become worse quickly just because you didn't go.
<4> I've had DVT a few times. They make a BIG deal out of "have chest pains, get thyself to hospital FAST"
<5> my landlady's son had that, pain in the chest. turned out to be a serious heart problem and the heart was already seriously affected. it was a close enough shot for him to stop smoking and drinking.
<4> yeah
<3> its not my heart, its more like.. oh nvm :) it isnt that aweful ::P
<4> near death will do that to you
<1> My Dad stopped smoking because of something similar.
<5> Bouncy: too much masterbatin'? :)
<1> One of the salsa dancers I knew vaguely died of a heart attack this week.
<4> that doesn't make the heart ache...it makes....umm, never mind :)
<3> you get chestpains bc of too much mastubation??
<5> rickety: that serves well as a wake up call, at times.
<3> lies! all lies!
<4> Bouncy: no, you go blind
<5> and start writing silly code
<1> Clackwell: He was about 60.
<4> haha
<5> oops, sorry, could not resist. :)
<4> Clackwell: if you'd done that 20 seconds earlier, I'd have been spraying coke all over the keyboard :)
<5> rickety: haha, and here in germany they want people to work until 67...
<1> Clackwell: 69 here.
<5> rickety: wahahaha ;)
<1> Clackwell: You don't have to keep telling me where you live, btw.



<6> hurro
<3> seriously tho. nn all.
<5> rickety: was he kind of active in the salsa and dancing area? i would expect those to be physically in better shape than joe average.
<6> quick question.. I'm trying to retrieve the values out of an ordered int binary tree into an array.. any idea how to do it? ;D
<5> nuke night?
<5> quick answer: tried google yet?
<5> knee jerk reaction to keyword "quick"
<6> I'm trying to recursively traverse the tree.. but it's a pain in the bum to get my head round
<1> Clackwell: He was more of an observer really. He looked fairly physically fit, but you can't see cholesterol.
<6> yes, I have looked at google
<5> rickety: or blood fat and whatever else are tricky factors, yeah.
<5> TradeMark: no clue
<7> TradeMark traverse the array copying the int's to an array as you go
<7> obviously get size first
<4> what kind of tree exactly? It doesn't have any way to get an iterator?
<7> int's some int tree so it's not a collection cl***
<0> anyway, time for me to get some sleep.
<6> it's a self-rolled tree basically.. each node has references to its two children and parent
<7> if it were they have a built in method
<0> see ya guys.
<6> but traversing it is easier said than done ;P
<7> then use that method to self roll a toArray method
<5> bye Lion-O
<7> it's easy done and you have little choice
<4> but it is an ordered tree?
<7> deciding the size in the same step may be tough or impossible (unless it keeps count itself)
<6> yes, it's an ordered tree
<6> each node points to a lesser node and a greater node
<4> there's pseudocode to do this somewhere in Knuth then
<6> umm I have a variable which keeps track of the size, no problem there
<6> that would be helpful ;P
<4> and I can't imagine there aren't lots of examples on how to traverse an orered tree (at least in C, if not in Java) online
<4> start at root, traverse the right left subtree, traverse the right subtree, recurse as required.
<4> um, you know what I mean :)
<7> it'a a simple recursion
<4> each node becomes a tree in its own right (unless it's a leaf node)
<4> http://www.ib-computing.com/java/datastructures/tree_traversal.html
<4> it's reasonably simple...as long as it truly is an ordered tree
<2> I have two lines of code: Scanner input = new Scanner(System.in); regNum = input.nextLine(); if someone just presses enter instead of typing something, what will regNum be?
<2> I tried searching for the existance of "" and null, but it doesn't work.
<7> what cl*** is Scanner, I don't recognise it from the sdk ?
<1> New as of 1.5 I think, java.util.Scanner.
<7> what you can do is test it
<2> that's the one.
<2> well I printed regNum and just got a blank line
<2> but using an if loop to search for "" or null doesn't work.
<7> System.out.println( ">" + regNum + "<" ); t6o really see
<1> "an if loop"..
<2> ok not if loop
<7> should return ""
<2> that's from my old dos batch days
<7> did you use == or .equals ?
<7> to test ?
<1> ryanstein: My guess is that you should google for java string comparison site:leepoint.net
<2> ==
<7> why
<1> s/guess/answer/
<7> this is an object not a primitive
<7> you want to compare contents not address
<2> well I haven't learnt much about other ways.
<7> use regNum.equals( "" )
<7> no ==
<2> I'm only 8 weeks into my java module, part of my degree and the cl*** is full of dumb***es, so we're going really slow and all of a sudden I have a fully fledged car rental program to make.
<7> == compares the references not the contents of the String
<7> try www.thejavatutorial.com and Tinking in Java
<7> that is very basic OO
<2> ok thanks.
<7> Thinking in Java
<1> ryanstein: Do the dumb***es stop you from finding things out for yourself? E.g., when I was at college some idiots would turn off the power to all the computers.
<7> rickety we had some that did that, just once
<2> rickety: I can find something out for myself, but when you're taught string1 == string2 how would you know you should use string1.equals(string2) ?


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #java
or
Go to some related logs:

allnightcafe
insmod: error inserting 'r8180.ko': -1 Unknown symbol in module
#linux
invalid conversion int* to int C++
#AllNiteCafe
#linux
maxbern
createwindow flatstyle
#linux
u.Torture



Home  |  disclaimer  |  contact  |  submit quotes