File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes literal string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "literal string" Watch "literal string" New topic
Author

literal string

WhyNot Ask
Greenhorn

Joined: Apr 21, 2003
Posts: 2
i'm trying to change a string to literal, here is what i have for my code now:
current rule:
bind ?paramValue1 = new String ("12 months")
proposed:
bind ?paramValue1 = (?paramValue1 + "12 months")
thanks,
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

WhyNot Ask:
Howdy and Welcome to the JavaRanch! We hope you’ll enjoy visiting the site on a regular basis. However, your name is not in keeping with our naming policy here at the ranch. Please change your display name to an appropriate name as shown in the policy.
Thanks again and we hope to see you around the ranch!!
Jamie
[ April 21, 2003: Message edited by: Jamie Robertson ]
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2771
    
  10

Is there a question in there? It looks like you are defining a syntax, and maybe writing a parser for it. Even if I've guessed that much correctly, I'm still not sure what your question is.
WhyNot Ask
Greenhorn

Joined: Apr 21, 2003
Posts: 2
just wanted to know if the change will make it a literal value vs a string - i hope this answers your question - i'm a newbie!
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Originally posted by WhyNot Ask:
a literal value vs a string

hmmmm . . . they are not opposing things.
Strings can be literals if they are specified at compile time. Being a literal is just an efficiency that the JVM uses.
String x = "12 months";
In this case x is a variable that references a String that is a literal. Since it can be resolved at compile time it is a literal.
final String x = "12 months";
Now we have made variable a constant, always referencing the same String literal.
String x = new String(args[0]);
In this case the value of the String can not be resolved at compile time.
[ April 22, 2003: Message edited by: Cindy Glass ]

"JavaRanch, where the deer and the Certified play" - David O'Meara
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
You might try reading
3.10.5 String Literals from the Java Language Specification.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: literal string
 
Similar Threads
syntax and selected index and month
literal string
Quick poll: if (str.equals("mystring")) vs if ("mystring".equals(str))
setting attribute in session in filter
trying to find union/intersection of arrays containing integers