Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > BOOK: Beginning Java 2
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Java 2
This is the forum to discuss the Wrox book Beginning Java 2, SDK 1.4 Edition by Ivor Horton; ISBN: 9780764543654
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Java 2 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 18th, 2006, 08:31 AM
Registered User
Join Date: Dec 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need to print a string value in a single line

Hi, can anyone please help me to print the string value "bbb" in the method "printing" as a single string value instead of two string values. My code is:

private void jComboBox4ActionPerformed(java.awt.event.ActionEve nt evt)
    String b=null;
    String bb=null;
    Object a=jComboBox4.getSelectedItem();
    printing(bb); //passing "bb" to the method "printing"

private void jComboBox5ActionPerformed(java.awt.event.ActionEve nt evt)
    String b=null;
    String bb=null;
    Object a=jComboBox5.getSelectedItem();
    printing(bb); //passing "bb" to the method "printing"

private void printing(String bbb)
    System.out.println("bbb: "+bbb);

My output is:
bbb: 0
bbb: n

But need my output as:
bbb: 0n

  #2 (permalink)  
Old February 13th, 2007, 06:36 AM
Friend of Wrox
Points: 1,515, Level: 15
Points: 1,515, Level: 15 Points: 1,515, Level: 15 Points: 1,515, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Dec 2003
Location: Oxford, , United Kingdom.
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts

Well yeh, it will do it like that because that's how you've structured your program ;)

If you need it to do:

bbb: OnnnOnO... etc.

Then print the "bbb: " in your constructor and replace your System.out.println with System.out.print.

Charlie Harvey's website - linux, perl, java, anarchism and punk rock: http://charlieharvey.org.uk

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
store a single line of text from a file....how???? danielnixon General .NET 2 May 1st, 2008 12:09 PM
Section Line Not to Print bharatsaboo Crystal Reports 2 November 4th, 2007 11:45 AM
Reading a string from line by line vaidyapragati ASP.NET 2.0 Professional 1 May 3rd, 2007 08:43 AM
how to return string value with quotes (single or tllcll BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 3 November 10th, 2005 01:57 PM
html table data single line -- Solved rupen HTML Code Clinic 1 August 8th, 2005 02:26 PM

All times are GMT -4. The time now is 05:20 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.