بسم الله الرحمن الرحيم
السلام عليكم ورحمة الله وبركاته
أحتاج إلى معرفة ماهو عمل الدالة CharAt الدالة getChars في البرنامج التالي بمعني ماهي وظيفته
لقد تتبعت البرنامج والحمدلله فهمت بعض الاشياء ....
public class getchars
{
public static void main( String args[] )
{
String s1 = "hello there";
char charArray[] = new char[ 5 ];
System.out.println( "s1:"+s1 );
// test length method
System.out.print( "\nLength of s1: "+ s1.length() );
// loop through characters in s1 with charAt and display reversed
System.out.print( "\nThe string reversed is: " );
for ( int count = s1.length() - 1; count >= 0; count-- )
System.out.print( " "+s1.charAt( count ) );
// copy characters from string into charArray
s1.getChars( 0, 5, charArray, 0 );
System.out.print( "\nThe character array is: " );
for ( char character : charArray )
System.out.print( character );
System.out.println();
} // end main
} // end class StringMiscellaneousوجزاكم الله خيرا
احتاج فهم فقط وظيفتهم وعملهم في البرنامج السابق
ووفقكم الله
