-1
我試着去創建並添加字符串列表創建和添加項目列出JAVA
package the.arraylist.pkgclass;
import java.util.ArrayList;
/**
A class to implement a Polynomial as a list of terms, where each term has
an integer coefficient and a nonnegative integer exponent
@author your name
*/
public
class Polynomial
{
// instance variable declarations go here
Term theTerm ; //initializes a term
/**
Creates a new Polynomial object with no terms
*/
public
Polynomial()
{
// TO DO: Write constructor body here
ArrayList<Term> list1 = new ArrayList<>();
}
/**
Inserts a new term into its proper place in a Polynomial
@param coeff the coefficient of the new term
@param expo the exponent of the new term
*/
public
void insert (int coeff , int expo)
{
// TO DO: write method body here.
}
我不覺得我已經正確初始化列表,因爲我不能在名單上調用insert class。
這些字符串將包含已經是字符串的多項式。
不確定你的意思是「字符串將包含已經是字符串的多項式」 – Claudio