小编Aur*_*ssi的帖子

在比较字符串时,在Java中使用if with Scanner无法正常工作

import java.util.*;

class Sept1Little {
    public static void main (String args []) {

        Scanner s = new Scanner(System.in);

        System.out.println("Hey! I'm not gonna program today o.o but I'm gonna do a little program :3");
        System.out.println("Let's play with some math!");
        System.out.println("Enter two numbers and magic will happen");
        System.out.print("Enter the first number: ");
        float a = s.nextInt();
        System.out.print("Enter the second number: ");
        float b = s.nextFloat();
        float c = (float) Math.pow( a, b);
        System.out.printf("The number is :%f\n" , c);
        System.out.println("We love Bernie Sanders!"); …
Run Code Online (Sandbox Code Playgroud)

java

1
推荐指数
1
解决办法
130
查看次数

标签 统计

java ×1