开发者

How can use a function ( if ) on javascript [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.
import java.util.Scanner; 

public class nothing

{

    public static void  main ( String arge[] )


    {

        Scanner input = new Scanner ( System.in );

        int mork; 
        int mork1;
        int mork2;
        int mork3;


        System.out.print ( " Enter The mork ");
        mork = input.nextInt();

        if (mork > 90 )
        System.out.print("A");

        if ( mork1 > 80)
        System.out.print("B");

        if ( mork2 > 70)
            System.out.print("C");

        if (mork3 >= 60)
            System.out.print(开发者_StackOverflow中文版"D");

        else System.out.print("H");



    }


That's definitely JAVA not JavaScript...

[EDIT]

Here is valid way to do a if/else if/else statment in Java, if that's what you're asking...

import java.util.Scanner;

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

        int mork;
        int mork1; // <--- never used...
        int mork2; // <--- never used...
        int mork3; // <--- never used...

        System.out.print( " Enter the mork " );
        mork = input.nextInt();

        if( mork > 90 ) {
            System.out.print( "A" );
        }else if( mork > 80 ) { // <-- changed mork1 to mork since mork1 is never initialized
            System.out.print( "B" );
        }else if( mork > 70 ) { // <-- changed mork2 to mork since mork2 is never initialized
            System.out.print( "C" );
        }else if( mork >= 60 ) { // <-- changed mork3 to mork since mork3 is never initialized
            System.out.print( "D" );
        }else{
            System.out.print( "H" );
        }
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜