store data in array from another class method -


i have 1 method in class call class1

' public void geteventfromuser() {     int event;     scanner input = new scanner(system.in);     date.getdatefromuser();     // od.inputday();     // od.inputyear();     time.gettimefromuser();     system.out.println("enter description :");     description = input.nextline();      }' 

and want execute method , store in array in class like

public void addevent() {     if (numevent == maxevent) {         system.out.println("error…no more room add events");     } else {         schedule[numevent]=geteventfromuser();         int count = 0;         while (count < numevent - 1) {             if (schedule[numevent].isequal(schedule[count])) {                 isfound = true;                 break;                               }             count++;             if (isfound == true) {                 system.out.println("event exists-notadding");                              schedule[numevent] = null;             } else {                 schedule[numevent].setdate();                 schedule[numevent].settime();                 schedule[numevent].setdescription();                 numevent++;                 //schedule[numevent]=schedule[numevent].geteventfromuser();             }         }     } } ' 

so,how can this? pls give me solution

geteventfromuser() doesn't return value, why schedule[numevent]=schedule[numevent].geteventfromuser() giving trouble.

without knowing bit more you're trying do, it's hard if should have geteventfromuser() return value or have geteventfromuser() directly store value in field in class. (i'm guessing setdate, settime , setdescription methods this.)


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -