This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Get Programming with Java (MEAP only) and have Peggy Fisher on-line!
See this thread for details.
Win a copy of Get Programming with Java (MEAP only) this week in the Beginning Java forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Using Strings instead of methods  RSS feed

 
Greenhorn
Posts: 19
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm pretty sure this is fairly obvious but I am sort of new to this and I've tried looking it up but I can't quite get what I'm looking for.

In my code, I want to, for my sake, use Strings for messages and paragraphs instead of using methods for everything - mainly because it will help me distinguish in-game commands from simple strings.
What type of string should I use, and how do I use and call it? I've looked everywhere but when I type it in it gives me some error.

 
Master Rancher
Posts: 3038
106
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Drew,

welcome to the ranch, and enjoy the stay!

Sounds like you could use a Properties file, where you store pairs of Strings. The first String is used to look up the second String. Have a look at the Oracle tutorial:
Properties
 
I suggest huckleberry pie. But the only thing on the gluten free menu is this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!