473,473 Members | 2,134 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to print "?

2 New Member
I'm using BlueJ, not really sure if there is a diffrence in versions... i'm using windows XP if more info would be needed to indentify specific solution, please tell me what is needed. If this is a double post, my apologies. I searched quite a few pages and will need log off soon so can't check them all...
i'm new at java, so i'm gonna ask a question some(probably all) of u might think is stupid. i want to know how do u make the computer to print a " in System.out.println and/or JOptionPane.showMessageDialog or any other thing. now every time i try to do it it just automaticlly assume it's another new start/end of a phrase. right now i'm resorting to this idiotic way:
String asdf = JOptionPane.showInputDialog("please write in '' ");
// i ask the user to type in " himself (i used two ' in the request in the hope of the user use a double qutation mark)
System.out.println(asdf+ "blahblahblah" +asdf);
this is not the best way i guess, so please help
i would like one of the two following solution (i don't know how to do them)
1. to print " in the println and stuff
2. enable the system to automaticly set " as a variable (i used asdf in this case) so the user don't have to type it in every time.
i have a manual in Chinese, not the best for a computer language that is English based...
Aug 16 '07 #1
3 1752
Ganon11
3,652 Recognized Expert Specialist
In order to print certain characters, you have to use an escape sequence. The escape sequence for the " character is \". So every timer you wish to display ", put \" instead. Some other common escape sequences are \\ (for a single \), \' (for a ' character), \n (for a newline), \t (for a tab), etc. A google search for escape sequences may provide a more thorough list.
Aug 17 '07 #2
JosAH
11,448 Recognized Expert MVP
In order to print certain characters, you have to use an escape sequence. The escape sequence for the " character is \". So every timer you wish to display ", put \" instead. Some other common escape sequences are \\ (for a single \), \' (for a ' character), \n (for a newline), \t (for a tab), etc. A google search for escape sequences may provide a more thorough list.
Minor nitpick: singlequotes ' don't need to be escaped in literal strings. They do
need to be escaped when you want a single quote character: '\''

kind regards,

Jos
Aug 17 '07 #3
rosedream
2 New Member
Thanks everyone. I needed the \n part too. Now I don't need to ask. I hope I learn a lot more stuff soon so I can make fun little programs.
Aug 18 '07 #4

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

Similar topics

16
by: John Baker | last post by:
HI; I feel like a fool..I put CUTE FTP in my last request for help --it should have been CUTE PDF! I have FTP on my mind because I have been working on a web based application, and somehow my...
5
by: Paul Sullivan | last post by:
We are a state agency that views protected medical information via our intranet. The screens even have privacy shields. Alarmingly, uses can "Print" and "Save As" which destroys the protection of...
1
by: Steve | last post by:
I have been trying to find documentation on the behavior Can anyone tell me why the first example works and the second doesn't and where I can read about it in the language reference? Steve ...
22
by: stephen | last post by:
I have created an order form that users javascript to create a new html document when the customers clicks the "print page" button. Once the new document has been created it then prints the...
1
by: Steff | last post by:
I am wandering if my code is making sense... I use a lot the print function. Is it weird in this case where I have to display an array ? I thought it would be better to have the entire array in php...
2
by: kbperry | last post by:
Hi all, I am getting an error message when trying to use the P4 print command via the python api for perforce. Anytime that I run p4c.run("print","-q", eachFile), I keep getting an error...
1
by: Appu | last post by:
How to Check in the window print dialog box whether we clicked either "print" or "cancel". while clicking a button i call wnidow.print() to pop up the windows PRint Dialog box. I want to check...
2
by: Bill_DBA | last post by:
I have the following stored procedure that is called from the source of a transformation in a DTS package. The first parameter turns on PRINT debug messages. The second, when equals 1, turns on the...
10
by: Prisoner at War | last post by:
Hi, your friendly neighborhood n00b here, just wondering why on earth the Py3K folks want to mess with a simple thing like the "print" "command" (is that what it's called, a command?), turning it...
2
by: sixtyfootersdude | last post by:
Good Morning! I am just starting to learn perl and I am somewhat mistifide about when I should do: print("@input"); and when I should do: print(@input)
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.