This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
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,
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 ]
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); 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