how would i quote out System.out.println ("A leaning toothpick sum: "\+\=\\" but "/&\is/\"."); :| * Quits: Ethereal^work (Ethereal_w@IDoNotExist.users.quakenet.org) (Ping timeout) * Quits: StM (~StM@JMB.users.quakenet.org) (Ping timeout) * Joins: Ethereal^ (Ethereal@IDoNotExist.users.quakenet.org) * Joins: Ethereal^work (Ethereal_w@a88-115-37-233.elisa-laajakaista.fi) <@Fx21> huh? * Quits: Ethereal (Ethereal@IDoNotExist.users.quakenet.org) (Read error: Connection reset by peer) * Quits: Ethereal^work (Ethereal_w@a88-115-37-233.elisa-laajakaista.fi) (Registered) * Joins: Ethereal^work (Ethereal_w@IDoNotExist.users.quakenet.org) basically i got to do this assigment say i have a string System.out.println ("She said \"I'm flying tonight\", then left for Jakarta!"); * Joins: StM (~StM@84.243.238.115) to use a quote i would put a backslash before it so i wouldnt get an error but what happens if i already have backslashes in the string * Quits: echello (~tsogna@140.h.011.mel.iprimus.net.au) (Signed off) you should escape those as well how do i do it ? \\ :) i dont have a bleeding clue ("A leaning toothpick sum: "\+\=\\" but "/&\is/\"."); for that ^ :/ * Joins: IrM00NSAe (heller@ist.ein.fan.von.gnx-network.de) you escape backslashes using a backslash so how would it look so you just add another backslash? i did but it didnt work no, im not saying thats the answer im trying to understand this as well :) :) you add the same amount of backslashes to cancel out the previous backslashes? * Quits: teppi|work (~sl@n074-003.dsl.kunde.inter.net) (Signed off) hmm so how would it look ("A leaning toothpick sum: \\\\"\+\=\\" but \\\\"/&\is/\"."); ? looks a bit odd to be honest * Parts: IrM00NSAe (heller@ist.ein.fan.von.gnx-network.de) yeh but then again, im as good at coding as g.w. bush is att running a country. :/ s/att/at im so confused have you tried running it like that? the last one you typed...that looks odd how u mean yeh it did \\ is \ \\\\ is \\ MasseR ("A leaning toothpick sum: "\+\=\\" but "/&\is/\"."); so -> "\+\=\\" would be "\+\=\" `? how would i get it to print A learning toothpick sum: "\+\=\\" but "/&\is/\". <@Fx21> don't give him the full answer lol hehe <@Fx21> he'll just copy it and not learn anything so many people here know :p come on edge`logansama im trying to work it out we've basically told you how to do it hmm you really havnt because what i thought it was didnt work sure we did edge`logansama what happens when you just run it the way you had it from the beginning? escape backslashes by adding another backslash wda: error ok wont even compile what i understand from what Olafski just typed to escape a backslash u use another backslash he means that you can either evade that problem by adding 1 backslash yeh where to tho or he means you need 1 backslash for each other backslash you want to escape there cant be that many places to try it wda: for every \ you want to display, you need to put \\ in the string so "\+\=\\" but "/&\is/\" would look like \\\"\+\=\\" but \\"/&\is/\" i'd try it if I had the whole code Olafski ohh, then i misunderstood wtf edge`logansama :s IM NEW TO THIS I DONT HAVE A CLUE geeze i do php ah okay i dont do bloody java that's all the help you got from me then stupid uni no need to get like that about it :) :/ i wasnt getting "like" about it (and in php you need to escape your quotes as well) yes if you haven't heard of escape characters, you didnt follow your courses properly erm ive followed all my courses properly ididot yeah that's a sure way to get help from people :P its just irritating when theres people sitting here knowing the answer edge`logansama patience is a virtue :P lol <@Fx21> :) edge`logansama are you pressured by time? pressured by bad planning :P and attitude <@Fx21> edge`logansama, maybe you could try to write increasingly difficult strings and work your way to the solution that way edge`logansama are you pressured by time? yes this is the final question then i can hand it in but is there a deadline? 2pm but i need to drive to scotland from bristol :( to hand it in? no oh to go home and see my family id try to help you some more, but im as new to Java as you are...or even newer, i just started coding and began with Java. a \ has a meaning when put in a string, not like a b c d e f etc. * deeage is now known as Deeage there are other "special" characters \ escapes these characters and it also escapes itself hehe then what is its use? if not only to escape or maybe that's its only use :S it's only to escape ok fx \n which you probably know is an endline character \r\n is carriage return, endline but does "\+\ = \\" count as 4 backslashes or only as 2? What do you mean with count? -sysout "\+\ = \\" <+Suzy-chan> execPlugin/Exec.java:42: illegal escape character <+Suzy-chan> sysout("\+\ = \\" <+Suzy-chan> ^ :o \+ has no special meaning, therefor error + characters does not need escaping, \ does ahh, i see i think its getting clearer...i have to type it to see if im right or just wishing im right. hmmm -sysout "\\o/" <+Suzy-chan> \o/ you can do like I did and test it with the bot -sysout "/&\is/\" <+Suzy-chan> execPlugin/Exec.java:42: illegal escape character <+Suzy-chan> sysout("/&\is/\" <+Suzy-chan> ^ -sysout "\\+\=\\" <+Suzy-chan> execPlugin/Exec.java:42: illegal escape character <+Suzy-chan> sysout("\\+\=\\" <+Suzy-chan> ^ -sysout \"\+\=\\" <+Suzy-chan> execPlugin/Exec.java:42: illegal character: \92 <+Suzy-chan> sysout(\"\+\=\\" <+Suzy-chan> ^ hehe :/ lol edge`logansama, you escaped the first backslash continue to escape the other (your first attempt, 2nd is no good) -sysout \"\+\\=\\" <+Suzy-chan> execPlugin/Exec.java:42: illegal character: \92 <+Suzy-chan> sysout(\"\+\\=\\" <+Suzy-chan> ^ -sysout \\"\+\=\\" <+Suzy-chan> execPlugin/Exec.java:42: illegal character: \92 <+Suzy-chan> sysout(\\"\+\=\\" <+Suzy-chan> ^ CLOSE naah gettin colder -sysout \\"\+\\=\\" <+Suzy-chan> execPlugin/Exec.java:42: illegal character: \92 <+Suzy-chan> sysout(\\"\+\\=\\" <+Suzy-chan> ^ WOADJIAWODJAWD hehe calm down :D >_< Okay, listen let's start with "" that's a string now we put stuff into it uhuh what's the first thing we want to put in it? :P a backslash, right? ("A leaning toothpick sum: "\\+\=\\" but "/&\is/\"."); thats my string small steps, bro ok the first you want to output is a backslash ok and i'm telling you that backslash is the escape character which escapes other characters and also itself that means we need to to \ (to start escaping) and then \ to tell it which character to escape that's \\ -sysout "\\" <+Suzy-chan> \ now what? a +? its nothing i think Write a Java program called Backslash in package assignment1 which outputs this string: sorry what? A leaning toothpick sum: "\+\=\\" but "/&\is/\". thats what i have to do so i guess + alrighty is just text [11:35:20] + characters does not need escaping, \ does yes, it is -sysout "\\+ <+Suzy-chan> execPlugin/Exec.java:42: unclosed string literal <+Suzy-chan> sysout("\\+ <+Suzy-chan> ^ -sysout "\\+" <+Suzy-chan> \+ my bad now another backslash - same procedure as before - you do this one -sysout "\\+\\=\\\\\" <+Suzy-chan> execPlugin/Exec.java:42: unclosed string literal <+Suzy-chan> sysout("\\+\\=\\\\\" <+Suzy-chan> ^ 1 too many \'s at the end -sysout "\\+\\=\\\\" <+Suzy-chan> \+\=\\ you're escaping the ending of the string righty thats all i wanted to know i was doign it at the front yes, now we got the first part right (except what we need to enclose it in "") and it was so irritating Xabster: yes "-characters also need escaping * Quits: |arda| (~kvirc@p548654A8.dip.t-dialin.net) (Read error: Operation timed out) * Joins: star_gazbpmi (~Mcbride@port12.ds1-ro.adsl.cybercity.dk) well he gotta \ alot in that sentence :p :) -sysout \"\\+\\=\\\\"\" <+Suzy-chan> execPlugin/Exec.java:42: illegal character: \92 <+Suzy-chan> sysout(\"\\+\\=\\\\"\" <+Suzy-chan> ^ the first and last "-character can not be escaped they mean the start and end of the string ok -sysut \"\\+\\=\\\\ -sysout \"\\+\\=\\\\ <+Suzy-chan> execPlugin/Exec.java:42: illegal character: \92 <+Suzy-chan> sysout(\"\\+\\=\\\\ <+Suzy-chan> ^ you need to start and end all -sysout commands (or string declarations with "-character) * Joins: teppi|work (~sl@n074-003.dsl.kunde.inter.net) -sysout \"\\+\\=\\\\" <+Suzy-chan> execPlugin/Exec.java:42: illegal character: \92 <+Suzy-chan> sysout(\"\\+\\=\\\\" <+Suzy-chan> ^ * Deeage is now known as deeage you're breaking form -sysout "\\+\\=\\\\" <+Suzy-chan> \+\=\\ -sysout " put stuff here " <+Suzy-chan> put stuff here -sysout " \\+\\=\\\\ " <+Suzy-chan> \+\=\\ * Joins: sco_uni (~sco_uni@holodoc.fim.uni-passau.de) -sysout " \" \\+\\=\\\\ \" " <+Suzy-chan> " \+\=\\ " i thought all teaching in irc should be done in the goold old time proven "sarcasm and ridicule" format -o * Parts: star_gazbpmi (~Mcbride@port12.ds1-ro.adsl.cybercity.dk) -l read up, Woflborg hmm we did that part :) im completely lost oh dont mind me then edge`logansama why? Xabster is explaining it quite nicely :) the put stuff here part atleast the first part of that backslash-string you have confused me put stuff here = filling your string with whatever you want (i guess) already, look here, edge`logansama: [11:46:29] -sysout " \" \\+\\=\\\\ \" " [11:46:31] <+Suzy-chan> " \+\=\\ " I over-spaced it start with " without any \ stuff and end with it also ah i got that part " = start or end of string-declaration \ = next character will be treated not-normal \" = put a "-character in the string ok \\ = put a \-character in the string \n = put a new-line character in the string im working on "/&\is/\" now your teacher probably wants you to use nonabnormal characters ;) Okay, i gave you a small table of stuff that needs to be escaped, now identify which characters needs escaping in that text you just pasted, edge`logansama and i've heard that bringing an apple can help -sysout \"/&\\is/\\\" <+Suzy-chan> execPlugin/Exec.java:42: illegal character: \92 <+Suzy-chan> sysout(\"/&\\is/\\\" <+Suzy-chan> ^ damn dude first rule, all strings START with " and END with " nearly :p what you just tried starts with \ and ends with " no but it actually worked yes no ? maybe it did run-single: A leaning toothpick sum: "\+\=\\" but "/&\is/\" BUILD SUCCESSFUL (total time: 0 seconds) if i were you i'd bring an apple yay for edge`logansama \o/ thanks guys sorry to be such a bum or other fruit based solution cya cheers mojn what a gay problem :( how mature :P university for real? I'm 100% sure you teacher or lecturer would not pose such a problem without telling you about escape characters and/or give me you a chapter to read i dont have the book :( no money Xabster: that would be hell. Professors popping in here, telling us that there are probably students incoming, read these chapters.. i see heh i'd really laugh my ass off if that ever happened then you would be a complete nerd and care to much but we are and we do i know sad innit * Xabster highfives Woflborg * Parts: edge`logansama (logan@81.19.220.25) actually it grows on you you spent that much time helping him and he just insults you and leaves? \\ * Joins: It_Just_Love (~mit@89.201.75.138) - edge`logansama is logan@81.19.220.25 * BNC from #X3-Servers www.X3-Servers.co.uk edge`logansama on @#edge @#cymru +#rastaclan #chelseafc +#wotr @#bodybuilding.uk +#css @#team-wales.cs edge`logansama using *.quakenet.org QuakeNet IRC Server edge`logansama is authed as maxs edge`logansama End of /WHOIS list. - he's a counterstriker i guess suppose so yeah "omg I follow my courses properly" "however I don't have a book"