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 7163851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:58:19+00:00 2026-05-28T13:58:19+00:00

I have done a google around but can’t get my head around what’s wrong

  • 0

I have done a google around but can’t get my head around what’s wrong with my code here.

I’m getting an Illegal start of expression error in the if statement at the first ‘Else if’

I’m pretty new to Java but trying to quickly learn as its a requirement of my computing course I’m hoping to do.

Any help greatly appreciated.

import java.util.Scanner;

public class net_salary{

public static void main(String[]args){    
    Scanner in = new Scanner(System.in);    

    int income;
    int incometax;
    int afterincometax;
    int nationalinsurance;
    int afterni;
    int pension;

    income = in.nextInt();       

    if(income = 0) {
        incometax = 0;
    } else if (income >=9000 & <=21000) {
        incometax = income * 0.15;
    } else if (income >=21000 & <=31000) {
        incometax = income * 0.2;       
    } else if (income >=31000 & <=50000) {
        incometax = income * 0.225                
  • 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-05-28T13:58:19+00:00Added an answer on May 28, 2026 at 1:58 pm

    You need else if (income >=9000 && income <=21000) instead of else if (income >=9000 & <=21000).

    Similarly for the other else if expressions.

    You have to make two separate comparisons to income. You can’t say “if income is greater than or equal to 9000 or less than or equal to 21000”. You must say “if income is greater than 9000 or income is less than or equal to 21000”.

    & is a bitwise AND. && is logical AND.

    As stated by others, income = 0 should read income == 0.

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

Sidebar

Related Questions

I have done a little but of looking around on google and think i
I've done some mucking around on Google but I still can't find what project
I have done a lot of looking around on the overflow, and on google,
I am using google Api for custom search and have done the json Parsing.
Ok I am still learning this... I have Googled and done some research but
I have done my research but have found nothing specific enough to my problem
I have done this and it is not working. I am getting force close
I have done quite some cocoa-touch stuff, but am still new to cocoa. I
I have done Java and JSP programming in the past, but I am new
I have changed code around to basically load an add the bottom of the

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.