似乎没有简单的方法可以做到这一点,但这是我到目前为止所做的,如果有人能够纠正它,使其工作将是伟大的.在"newarray [e] = array [i] .intValue();" 我收到一个错误"没有命名方法"intValue"在类型"java.lang.Object"中找到." 救命!
/*
Description: A game that displays digits 0-9 and asks the user for a number N.
It then reverses the first N numbers of the sequence. It continues this until
all of the numbers are in order.
numbers
*/
import hsa.Console;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Arrays;
public class ReversalGame3test
{
static Console c;
public static void main (String[] args)
{
c = new Console ();
c.println ("3. REVERSAL GAME"); …Run Code Online (Sandbox Code Playgroud) 我需要添加一个"清除计算器"的按钮,以及一个退出butPanel上的程序的按钮.它也需要是非常基本的Java代码,因为我是初学者,并且有一个糟糕的comp.sci.老师.我有一个带退出按钮的代码示例,但我不确定如何将它放入我的程序中.我已经尝试了这么多.此外,如果有一个更好的"错误检查"方式,将非常感激.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Calculator2 extends JFrame implements ActionListener
{
JLabel heading = new JLabel ("2. Calculator");
JLabel intro1 = new JLabel ("This program stimulates a four-function calculator.");
JLabel intro2 = new JLabel ("It takes an operator and a number. It can add, subtract,");
JLabel intro3 = new JLabel (" multiply and divide. Enter in the format eg. '+35'. ");
JLabel inLabel = new JLabel (" Operation: ");
JLabel outLabel = new JLabel (" Total: …Run Code Online (Sandbox Code Playgroud)