小编Rya*_*son的帖子

Java多个扫描仪

我有一个创建多个Integer对象的类,并将它们放入LinkedList如下所示:

public class Shares<E> implements Queue<E> {
    protected LinkedList<E> L;

    public Shares() {
        L = new LinkedList<E>();
    }

    public boolean add(E price) {
        System.out.println("How many of these shares would you like?");
        Scanner scanInt;
        scanInt = new Scanner(System.in);
        Integer noShares = scanInt.nextInt();
        for (int i = 0; i < noShares; i++) {
            L.addLast(price);
        }
        scanInt.close();

        return true;
    }
}
Run Code Online (Sandbox Code Playgroud)

我有一个应用程序从控制台扫描输入"添加",如果找到,调用add如下所示的方法:

public class Application {
    private static Scanner scan;

    public static <E> void main(String[] args) { …
Run Code Online (Sandbox Code Playgroud)

java java.util.scanner

12
推荐指数
3
解决办法
3万
查看次数

在java中将图像旋转90度

我设法旋转图像,180 degrees但希望旋转它90 degrees clockwise可以有人编辑我的代码,以便它做到这一点解释.谢谢.

 private void rotateClockwise()
    {
        if(currentImage != null){
            int width = currentImage.getWidth();
            int height = currentImage.getHeight();
            OFImage newImage = new OFImage(width, height);
            for(int y = 0; y < height; y++) {
                for(int x = 0; x < width; x++) {
                    newImage.setPixel( x, height-y-1, currentImage.getPixel(x, y));
                }
        }
            currentImage = newImage;
            imagePanel.setImage(currentImage);
            frame.pack();
    }
    }
Run Code Online (Sandbox Code Playgroud)

java image image-rotation

10
推荐指数
2
解决办法
4万
查看次数

标签 统计

java ×2

image ×1

image-rotation ×1

java.util.scanner ×1