Solved

end of string?

Posted on 2000-05-09
2
174 Views
Last Modified: 2010-04-01

How can we know end of string in Java?
In c or c++ every string is terminated by null character.

0
Comment
Question by:Veena85
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 16

Accepted Solution

by:
imladris earned 25 total points
ID: 2793454
In Java every String has a length. Compare to that.

Example:

String str="abc";
char arr[]=new char[3];
for(i=0; i<str.length(); ++i)
{   arr[i]=str.charAt(i);
}
0
 
LVL 16

Expert Comment

by:imladris
ID: 2793459
Note: length is a method of the String class. Many other methods are available for strings. See documentation for the String class.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question