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
Solved

end of string?

Posted on 2000-05-09
2
173 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
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
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…
The viewer will learn how to implement Singleton Design Pattern in Java.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

809 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