Solved

end of string?

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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
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 will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

729 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