Welcome to Dream.In.Code
Become a Java Expert!

Join 149,522 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,384 people online right now. Registration is fast and FREE... Join Now!




string to object

 
Reply to this topicStart new topic

string to object

endsamsara
2 Jul, 2007 - 07:04 PM
Post #1

New D.I.C Head
*

Joined: 24 Feb, 2007
Posts: 16


My Contributions
Hi, How do i create a class called Text
that creates an object from a string
and that gets the first word of the text

have no idea

I was starting like

CODE

public class Text{
    public static void main(String[] args)
    {
       String str = "this is a little text and i have to find the first word this ";
    }
    
}



But really i have no idea blink.gif

Please any help is gratefull
User is offlineProfile CardPM
+Quote Post

skanand_139
RE: String To Object
2 Jul, 2007 - 10:20 PM
Post #2

New D.I.C Head
*

Joined: 2 Jul, 2007
Posts: 1


My Contributions
QUOTE(endsamsara @ 2 Jul, 2007 - 08:04 PM) *

Hi, How do i create a class called Text
that creates an object from a string
and that gets the first word of the text

have no idea

I was starting like

CODE

public class Text{
    public static void main(String[] args)
    {
       String str = "this is a little text and i have to find the first word this ";
    }
    
}



But really i have no idea blink.gif

Please any help is gratefull

wub.gif
[code]
by refering to the book "the complete reference to java by Hebert Schildt".thank u!!!!!!!!!!!!!1
User is offlineProfile CardPM
+Quote Post

PennyBoki
RE: String To Object
4 Jul, 2007 - 06:16 AM
Post #3

system("revolution");
Group Icon

Joined: 11 Dec, 2006
Posts: 2,010



Thanked: 7 times
Dream Kudos: 500
Expert In: Java,C++,C

My Contributions
QUOTE(endsamsara @ 2 Jul, 2007 - 08:04 PM) *

Hi, How do i create a class called Text
that creates an object from a string
and that gets the first word of the text

have no idea

I was starting like

CODE

public class Text{
    public static void main(String[] args)
    {
       String str = "this is a little text and i have to find the first word this ";
    }
    
}



But really i have no idea blink.gif

Please any help is gratefull



I would recommend that you take a look in the StringTokenizer class functions along with the String class
and HERE is an example.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 08:31PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month