lundi 14 juin 2021

"Syntax error on token "if", delete this token" error is shown on if (java) [closed]

I wrote a java code as a practice for my college assignment. In if-else statement I got an error as "Syntax error on token "if", delete this token". I think I had tiny mistake like ;.But I can't find it out the error

I commented the area which shows the error. The code I have written is below.

package com.slt.dbal;

import java.util.Scanner;

public class DataBalance {

    public static void main(String[] args) {
        
        //Methods
        PackDetails pd = new PackDetails();
        Scanner scn = new Scanner(System.in);
        
        //welcome note
        System.out.println("\nHello, \tWelcome to SLT available data amount finder...\n");
        
        
        //Select package
        int pid;
        
        System.out.println("Enter your package ID from the list below...");
        System.out.println("WEB PAL\t\t- 1\nWEB FAMILY ACTIVE\t- 2");
        
        System.out.print("\nPackage ID: ");
        pid = scn.nextInt();
        
        System.out.println(" ");
        
        //Show selected package to the user
        String pName;
        
        if (pid == 1) {
            
            pName = "WEB PAL";
            
        }
        else {
            
            //Error         
            if {
                pName = "WEB FAMILY ACTIVE";
            }
            //Error
            
        }
        
        System.out.println("Package you selected is " + pName+ "\n\n");
        
        //##################################################################################
        
        //Input users' package current usage
        double SDUse, TDUse;
        
        System.out.print("Enter Standard usage: ");
        SDUse = scn.nextDouble();
        
        System.out.print("Enter Total usage: ");
        TDUse = scn.nextDouble();
        

    }

}

Aucun commentaire:

Enregistrer un commentaire