• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

String without double quotes

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am new to Java,

I want to insert a string in database but it should not have double quotes.

e.g i want to insert string TJ2003W.

But when we declare this as string it is surronded by double quotes.

Pls help reagrding this.
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, the double quotes are only needed for Java so it knows you want to declare a String. The Stringobject itself doesnt contain the quotes!
Mark
 
Author
Posts: 253
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Segal:

Expanding on Mark's comment, in Java, a string literal is represented in a program's source code by enclosing the desired string within quotes. In the compiled version of the program, a String object is created that corresponds to that string literal. This object does not include the quotes.

For example, consider this line:

Here, "a test string" is a string literal. However, what str refers at runtime will be a String object that contains the characters a test string. It will not include quotes. Thus, a quoted string is simply a source code mechanism.
 
reply
    Bookmark Topic Watch Topic
  • New Topic