الموضوع: Fix the logical Errors
عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
  #1  
قديم 01-04-2011, 11:42 AM

looly77 looly77 غير متواجد حالياً

جامعي

 
تاريخ التسجيل: Mar 2011
التخصص: cs
نوع الدراسة: إنتظام
المستوى: الرابع
الجنس: أنثى
المشاركات: 9
Skaau.com (10) Fix the logical Errors


كود:

كود:
//The method below should compare two strings, //returns “same” if two Strings are identical. //If they differ, determines the position of //the first letter at which the two strings differs, //and returns that position
public
String compareStrings(String a,String b){
int
pos =0;
if
(a.equals(b)){
return
"same"; }else{
while
(b.charAt(pos)!=a.charAt(pos)); { pos++; }
return
"They differ at position:" + pos;
}}

رد مع اقتباس