עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

IllegalArgumentException עזרה

Featured Replies

פורסם

היי, אני מנסה לעשות שיעורי בית שקיבלתי, מדובר על קורס מבוא למדעי המחשב אז ניתן להבין שאני ממש חדש בנושא, עוד לא עברו איתנו אפילו על Exceptions (זה רק בקורס הבא), בניתי שתי מחלקות, שתיהן צריכות לכתוב דברים לקובץ כולל שם שבמידה והוא שתי מילים יש להחליף את הרווח בסימן אחר (תלוי במחלקה).
עובד לי מעולה במחלקה אחת:

public void printToFile(PrintWriter pw){
        pw.println(name.replaceFirst(" ",HASHTAG)+HASHTAG+passport+HASHTAG+suitcase);
    }//printToFile(PrintWriter pw)

 

ובמחלקה השניה זורק לי IllegalArgumentException במידה ואני עושה רווח בשם, יש לציין שהמתודות זהות (כמו שניתן לראות למטה):

public void printToFile(PrintWriter pw){
        pw.println(name.replaceFirst(" ",DOLLAR)+DOLLAR+employ_id+DOLLAR+total_airtime);
    }//printToFile(PrintWriter pw)

 

אשמח לקבל הסבר למה זה קורה וגם דרך לפתרון אם ניתן.
תודה מראש!

 

נ.ב, שכחתי לציין, מדובר על Java

נערך על-ידי Exolite

פורסם

קשה לדעת מה הבעיה בלי קונטקסט (מה הטיפוסים של כל המשתנים? מה השגיאה המדויקת שאתה מקבל? איזו פונקציה היא זו שיוצרת את השגיאה?)

 

נ.ב. כשאתה כותב קוד בפורום, תשתמש בכפתור הכנסת קוד.

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.