Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7743617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:34:50+00:00 2026-06-01T09:34:50+00:00

I am getting an illegal start of type error at the first nested if

  • 0

I am getting an illegal start of type error at the first nested if statement, having looked at similar questions i understand this is usually caused by a misplaced brace, however, i cannot see one. Could anyone help?

public class Journey
{
    private int date;
    private double time;
    private int busNumber;
    private int journeyType;
    public static double dayCharge;
    public static final double maxDayCharge = 3.50;
    public static double weekCharge;
    public static final double maxWeekCharge = 15;
    public static double monthCharge;
    public static final double maxMonthCharge = 48;
    private int journeyId;
    private static int numberOfJourneys;
    private double costOfJourney; 

    public int getDate(){
        return date;
    }  
    public Double getTime(){
        return time;
    }
    public int getBusNumber(){
        return busNumber;
    }
    public double journeyCost(journey reqJourney){ 
        if (journeyType = 1){                      //this is where the error occurs
            if (dayCharge =< 2.50)
            {
                costOfJourney = 1;
            }
            else 
            {
                costOfJourney = maxDayCharge-dayCharge;
            }

        }
        else if (journeyType = 2)
        {
            if (dayCharge =< 1.80)
            {
                costOfJourney = 1.70;
            }
            else 
            {
                costOfJourney = maxDayCharge-dayCharge;
            }
        }
        else if (journeyType = 3)
        {
            if (dayCharge =< 1.60)
            {
                costOfJourney = 1.90;
            }
            else 
            {
                costOfJourney = maxDayCharge-dayCharge;
            }

        }          
        return costOfJourney;    
    }
    public boolean isInSequence(journey reqJourney){
        journey prevJourney = jArray.get(jArray.size()-1);
        if (prevJourney.date > reqJourney.date)
        {
            return false;
        }

    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T09:34:51+00:00Added an answer on June 1, 2026 at 9:34 am

    You need to use == to test equality. = is the assignment operator.

    Oracle has good tutorial docs explaining Java operators.

    On a related note, there’s also an important distinction between Object.equals() and == which is covered in detail in other Stack Overflow questions like this one. However, when comparing primitive types like you’re doing, == is what you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why am I getting the error :java:16: error: illegal start of type for(int i
I'm getting illegal offset type error for every iteration of this code. Here's the
I am getting an error that this has an illegal continue statement. I have
I'm getting an Illegal offset type for this array: public static $CATS_AND_TYPES = array(
AM getting continuously the illegal character error in this url : http://my.server.com/SelectPerson-0.1/nativeService/businessCardSave?company=Select Person&fullName=Rghh Dgivv&email=uday@uioperr.info&phoneNo=123456789&desiredPosition=Machine
Note Learning Lisp I am getting this error: Illegal argument in functor position: (EVALEXP
So I'm getting some odd errors such as illegal start of type and variable's
I am getting a javascript (prototype.js) error: Unexpected token ILLEGAL at this line of
How come this is not possible? I am getting illegal start of expression. (s1.charAt(i)
I'm getting an Illegal characters in path error while using XMLTextReader method. Basically, I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.