4 Replies - 210 Views - Last Post: 03 February 2013 - 09:30 AM Rate Topic: -----

#1 am0n  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 40
  • Joined: 22-January 13

How do I store text?

Posted 03 February 2013 - 05:19 AM

Hello, I would like to know how to a store a text in Java, for example I can store a number 5 if I declare a variable with int, double etc.
but how do I store bunch of text like: "Hello my name is X"
Is This A Good Question/Topic? 0
  • +

Replies To: How do I store text?

#2 darek9576  Icon User is offline

  • D.I.C Lover

Reputation: 198
  • Posts: 1,688
  • Joined: 13-March 10

Re: How do I store text?

Posted 03 February 2013 - 05:42 AM

String class
StringBuilder class
Was This Post Helpful? 1
  • +
  • -

#3 GregBrannon  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2198
  • View blog
  • Posts: 5,226
  • Joined: 10-September 10

Re: How do I store text?

Posted 03 February 2013 - 05:44 AM

You should have a ready reference at your fingertips to answer these foundational language questions. Your textbook, an online resource, or an electronic reference of some sort should be at the ready.

There are String variables for storing text. A possible online source of info on Java Variables is the variables tutorial thread that begins here.
Was This Post Helpful? 1
  • +
  • -

#4 daarkfall  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 15
  • Joined: 27-August 09

Re: How do I store text?

Posted 03 February 2013 - 07:16 AM

http://heather.cs.ucdavis.edu/~matloff/Java/JavaIntro.html

Here is a relatively good introduction to java.

I would also recommend the text book head first with java
 http://www.amazon.co.uk/Head-First-Java-Kathy-Sierra/dp/0596009208 


Both are excellent resources for getting into grips with the basics of java programming :)/>

But essentially what you are actually looking for (so as to be of some use)

is

String x = " hello world "; //the string object is the most basic form of handling text in java
char [] x_two = {'h','e','l','l','o',' ', 'w','o','r','l','d'}; //similar to C you can also treat text as a character //array, 

//Strings can also be transformed into character arrays 
x_two = x.toCharArray(); // its something like that i am not on my development machine at the moment




Hope this helps dude

~Daark
Was This Post Helpful? 1
  • +
  • -

#5 am0n  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 40
  • Joined: 22-January 13

Re: How do I store text?

Posted 03 February 2013 - 09:30 AM

I see, thank you all.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1