Results 1 to 3 of 3
  1. #1
    felixnoriel is offline Member
    Join Date
    Mar 2011
    Posts
    1
    Rep Power
    0

    Default int cannot be dereferrenced, cannot find symbol method add

    Java Code:
    Process scheduledProcess;
    		
    
    private void assignNextProcess(){
    
                if (queue1.size() != 0){
    
                    scheduledProcess.add(Scheduler.SRTF.getNext(queue1));
    
                    if (scheduledProcess.getBurstTime(0) == scheduledProcess.getTimeRemaining(0)){
                        scheduledProcess.getResponseTime(0).add(time.remove(scheduledProcess.getArrivalTime(0)));
                    }
    
                    queue1.remove(scheduledProcess);
    
                    String msg = "Assigned Process " + scheduledProcess.getProcessNumber(0) + " to CPU";
                }
    
                else if (queue2.size() != 0){
    
                    scheduledProcess = Scheduler.NPP.getNext(queue2);
    
                    if (scheduledProcess.getBurstTime(0)==(scheduledProcess.getTimeRemaining(0))){
                        scheduledProcess.getResponseTime(0).add(time.remove(scheduledProcess.getArrivalTime(0)));
                    }
    
                    queue2.remove(scheduledProcess);
    
                    String msg = "Assigned Process " + scheduledProcess.getProcessNumber(0) + " to CPU";
                }
    
                else if (queue3.size() != 0){
    
                    scheduledProcess.add(Scheduler.FCFS.getNext(queue3));
    
                    if (scheduledProcess.getBurstTime(0)==(scheduledProcess.getTimeRemaining(0))){
                        scheduledProcess.getResponseTime(0).add(time.remove(scheduledProcess.getArrivalTime(0)));
                    }
    
                    queue3.remove(scheduledProcess);
    
                    String msg = "Assigned P" + scheduledProcess.getProcessNumber(0) + " to CPU";
                }
            }
    
    public class Process(){
       public int getBurstTime(int BurstTime) {
       		 return BurstTime;
       }
       public int getArrivalTime(int ArrivalTime) {
       	 	 return ArrivalTime;
       }
       public int getProcessNumber(int ProcessNumber) {
       		 return ProcessNumber;
       }
       public int getTimeRemaining(int TimeRemaining){
       		 return TimeRemaining;
       }
    }
    when i run this file, there's an error in the lines, and the other lines in the if statements, like this if statement, it has an error.

    if (scheduledProcess.getBurstTime(0) == scheduledProcess.getTimeRemaining(0)){
    scheduledProcess.getResponseTime(0).add(time.remov e(scheduledProcess.getArrivalTime(0)));
    }

    the error is "int cannot be dereferrenced" and its pointing out to the code in this if statement. what should I change in this code?

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,038
    Rep Power
    10

    Default

    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

Similar Threads

  1. HELP! can't find symbol-method
    By Jack9333 in forum New To Java
    Replies: 2
    Last Post: 03-04-2011, 02:48 AM
  2. Replies: 10
    Last Post: 12-22-2010, 02:12 AM
  3. cannot find symbol - method iterator()
    By D.Calladine in forum New To Java
    Replies: 1
    Last Post: 11-30-2010, 01:13 PM
  4. Replies: 8
    Last Post: 10-17-2010, 11:24 AM
  5. Replies: 3
    Last Post: 05-01-2008, 09:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •