Solved

end of string?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java Filesystem manipulation of Word Docx file (find replace text) 3 67
Java DateChooser? 3 29
session migration servlets 2 28
Arrays.asList  VS  ArrayList 4 45
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
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 …

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now