.class expected error

I am consistently recieving an error message that says ".class expected" on the "Easter date = new Easter (int year);" line every time i try to compile my tester class. Can anyone help me figure out the problem? Here is my tester/driver class:
* Tester Class
* Ben Mathews
* September 13th, 2009
public class EasterTester
public static void main (String [ ] arg)
Easter date = new Easter (int year );
date.calculate ();
}// end main
}// end Easter

When you post code, click on "CODE" to generate code tags and paste your code between the tags. Then it will look like this, which will help you get help. /*
Tester Class
Ben Mathews
September 13th, 2009
public class EasterTester
     public static void main (String [ ] arg)
          Easter date = new Easter (int year );
          date.calculate ();
     }// end main
}// end Easter When you define a constructor (or a method) with a parameter, you have to tell the compiler what type that parameter is, for example //a constructor example
public Easter(int year) But, when you use a constructor (or method) with a parameter, you just put in the value or variable, for example int year = 1999;
Easter date = new Easter (year);

Similar Messages

  • '.class' expected Error when trying to pass an Array

    In the below method I am trying to return an array. The compiler gives me one error: '.class' expected. I am not sure if I am writing the 'return' statement correctly and not really sure of another way to code it. Below is a portion of the code and I can post all of it if need be but the other methods seem to be fine.
    import java.util.Scanner;
    public class LibraryUserAccount
    Scanner input=new Scanner(System.in);
    private final int MAX_BOOKS_ALLOWED;
    private int checkedOutBookCounter;
    private long accountNumber;
    private String socialSecurityNumber, name, address;
    private final long isbnNumbers[];
    //constructor
    public LibraryUserAccount(long accountNumber, int maxBooksAllowed)
         this.accountNumber = 0;
         MAX_BOOKS_ALLOWED = maxBooksAllowed;
    //returns the array isbnNumbers[]
    public long getCheckedOutBooksISBNNumbers()
         return isbnNumbers[];
    The error displayed as:
    LibraryUserAccount.java:111: '.class' expected
         return isbnNumbers[];
    ^
    1 error
    Thanks in advance for the help.

    Rewriting the method as:
    public long[] getCheckedOutBooksISBNNumbers()
    return isbnNumbers;
    ... has fixed that particular compiler error. Thanks jverd. I appreciate the help.
    On a separate note I am having trouble with initializing the array. What I am trying to do is initialize an array of a size equal to a value passed to the class. Example being:
    //variables
    private final int MAX_BOOKS_ALLOWED;
    private long accountNumber;
    private final long[] isbnNumbers;
    //constructor method
    public LibraryUserAccount(long accountNumber, int maxBooksAllowed)
    this.accountNumber = 0;
    MAX_BOOKS_ALLOWED = maxBooksAllowed;
    long[] isbnNumbers = new long[MAX_BOOKS_ALLOWED];
    My goal is to set the size of isbnNumbers[] to the value of MAX_BOOKS_ALLOWED. I've tried a couple of different ways to initialize the array (the latest listed above) but the compiler doesn't like what I have done. Thanks again.

  • .class expected error when compiling

    Ive been getting this frustrating error when compiling. My program is essentially supposed to add the values in two matrixes and return a new matrix using the added values
    Heres my code:
       public Matrix add(Matrix comp)
            int[][] temp = new int[this.numRows()][this.numCols()];
            for (int a = 0; a < comp.numRows(); a++) {
                for (int b = 0; b < comp.numCols(); b++) {
                    temp[a] = this.myCells[a][b] + comp.getVal(a, b);
    Matrix addedMatrix = new Matrix(temp[][]);
    return addedMatrix;
    heres the constructor for Matrix object:
      public Matrix(int[][] mat)
            int[][] myCells = new int[mat.length][mat[0].length];
            for (int i = 0; i < mat.length; i++) {
                for (int j = 0; j < mat[0].length; j++) {
                    myCells[i][j] = mat[i][j];
        }getVal, numRows, and numCols are all helper methods that just return values.
    The error is '.class' expected in the line which says Matrix addedMatrix = new Matrix(temp[][]); I checked for extra brackets but there dont seem to be any.
    Any help would be appreciated. Thanks.

    I think you just needMatrix addedMatrix = new Matrix(temp);

  • Class Expected error - HELP

    Hi I've been workin on a project, and it seems something is wrong with this code... i honestly cannot figure it out...
    here it is :
    Uses the following methods:
    public static boolean areEquivalent (String word1, String word2)
    This method reutrns true or false depending on whether the two input arguments hae equal numbers of A's, B's, and C's (in any order.) You may assume that each string contains only these lowercase characters, in any order or quantity. For example, areEquivalent("abcbca","ccbbaa... ) would return true, because each input string contains 2 as, 2 bs, and 2cs.
    this is the code i have so far:
    public static boolean areEquivalent(String word1, String word2)
    int count = 0;
    String line;
    for ( int i = 0; i<char.length; i++)
    saasd
    if count = as + word 2
    true
    else count = bs + word 2
    true
    else count = cs + word 2
    true
    else as==bs==cs
    return true
    }

    Hi,
    May I know what is your actual code?
    And what error did you get?
    thanks
    daniel

  • '.class' expected compiler error

    Here is my code:
    import java.util.*;
    public class LetCount
      public static final int NUMCHARS = 27; //You define
    // int addr(char ch) returns the equivalent integer address for the letter
    // given in ch, 'A' returns 1, 'Z' returns 26 and all other letters return
    // their corresponding position as well.
      public static int addr(char ch)
        return (int) ch - (int) 'A' + 1;
    // Required method definitions for (1) analyzing each character to update
    // the appropriate count; (2) determining most frequent letter;
    // (3) determining least frequent letter; and (4) printing final results
    // should be defined here.
      public static char getCharValue(int index)
        char character;
        int intValueOfA = Character.getNumericValue('A');
        for (index = 1; index <= NUMCHARS; index++)
          int intValueOfChar = intValueOfA + index-1;
          character = (char) intValueOfChar;
        return character;
      public static void countLetters(int count[], String line)
        for (int lineIndex = 0; lineIndex < line.length(); lineIndex++)
          char letter = line.charAt(lineIndex);
          int arrayIndex = addr(letter);
          count[arrayIndex] = count[arrayIndex] + 1;
      public static char findMostFrequent (int [] count)
         int biggestCount = 0;
         int biggestCountIndex = 0;
        for (int arrayIndex = 1; arrayIndex <= NUMCHARS; arrayIndex++)
          if (count[arrayIndex] > biggestCount)
            biggestCount = count[arrayIndex];
            biggestCountIndex = arrayIndex;
        return getCharValue(biggestCountIndex);
      public static char findLeastFrequent(int [] count)
         int smallestCount = 0;
         int smallestCountIndex = 0;
         for (int arrayIndex = 1; arrayIndex <= NUMCHARS; arrayIndex++)
           if (count[arrayIndex] < smallestCount)
             smallestCount = count[arrayIndex];
             smallestCountIndex = arrayIndex;
         return getCharValue(smallestCountIndex);
      public static void printResults(int [] count)
         for (int arrayIndex = 1; arrayIndex <= NUMCHARS; arrayIndex++)
          System.out.println(getCharValue(arrayIndex) + " occurred " + count[arrayIndex] + " times.");
         System.out.println();
         System.out.println("Most frequent letter = " + findMostFrequent(count[]));
         System.out.println("Least frequent letter = " + findLeastFrequent(count[]));
      public static void main(String[] args)
        Scanner keyboard = new Scanner(System.in);  // for reading input
        int[] count = new int [NUMCHARS]; // count of characters
        String line;      // holds input line   
        // Other declarations as needed
        //initializes all elements of count[] array to 0
        for(int i=0; i<NUMCHARS; i++)
          count=0;
    // Method calls and other statements to complete problem solution go here
    while (keyboard.hasNext())
    line = keyboard.nextLine();
    System.out.println(line);
    countLetters(count[], line);
    printResults();
    }The error from the compiler occurs at the following lines:System.out.println("Most frequent letter = " + findMostFrequent(count[]));System.out.println("Least frequent letter = " + findLeastFrequent(count[]));countLetters(count[], line);Please help!  How do I change these lines so that the "'.class' expected" error is solved?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Thanks! Now I just have a run time error:
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -32
         at LetCount.countLetters(LetCount.java:51)
         at LetCount.main(LetCount.java:118)
    Lines 51 and 118 are these respectively:
    count[arrayIndex] = count[arrayIndex] + 1;In the countLetters method
    countLetters(count, line); At the bottom of main

  • "class or interface expected error"

    hi,
    i have these two classes that am using and when i try and compile them i get a class or interface expected error.
    i have looked at previous posts and checked that i have the right number of closed brackets.
    anyone any ideas?
    import java.io.*;
    import java.net.*;
    public class BookingServer {
    public static void main(String[] args) throws IOException {
    ServerSocket serverSocket = null;
         Socket mysocket = null;
    try {
    serverSocket = new ServerSocket(4444);
    } catch (IOException e) {
    System.err.println("Could not listen on port: 4444.");
    System.exit(1);
    Socket clientSocket = null;
    try {
    clientSocket = serverSocket.accept();
    } catch (IOException e) {
    System.err.println("Accept failed.");
    System.exit(1);
    PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
    BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
    String inputLine, outputLine;
    BookingProtocol bp = new BookingProtocol();
    outputLine = bp.processInput(null);
    out.println(outputLine);
    while ((inputLine = in.readLine()) != null) {
    out.println(inputLine);
    outputLine = bp.processInput(inputLine);
    out.println(outputLine);
    if (outputLine.equals("BYE"))
    break;
    out.close();
    in.close();
    clientSocket.close();
    serverSocket.close();
    *****************PROTOCOL***********************
    import java.io.*;
    import java.net.*;
    public class BookingProtocol {
    private static final int WAITING = 0;
    private static final int SENTLOGON = 1;
    private static final int SENTSEATREQ = 2;
    private static final int SENTSTATUSREQ = 3;
    private static final String LOGONPROMPT = "LOGON";
    private static final String SEATPROMPT = "SEAT";
    private static final String STATUSPROMPT = "STATUS";
    private static final String BYEPROMPT = "BYE";
    private int state = WAITING;
    public String processInput(String theInput) {
    String theOutput = null;
    if (state == WAITING) {
    theOutput = LOGONPROMPT;
    state = SENTLOGON;
    } else if (state == SENTLOGON) {
    theOutput = SEATPROMPT;
    state = SENTSEATREQ;
    } else if (state == SENTSEATREQ) {
    theOutput = STATUSPROMPT;
    state = SENTSTATUSREQ;
    } else if (state == SENTSTATUSREQ) {
    theOutput = BYEPROMPT;
    state = WAITING;
    return theOutput;
    in.close();
    clientSocket.close();
    serverSocket.close();

    you have too many }-brackets, the finalin.close();
    clientSocket.close();
    serverSocket.close();
    }is not inside any class

  • When calling method error .class expected

    First the method I'm calling.
    public void ExeSqlStmt(String sqlStmt, String columnNames[], String connectString, String userName, String password,int numColumns)
    This compiles clean. The code that calls the method is giving me fits with expecting .class, expecting ), can not resolve symble and unexpected type.
    The offending line is near the bottom of the code.
    Thanks,
    -Rob
    package jdba;
    * Execute the sql statement
    // java imports
    import java.util.Vector;
    import java.awt.event.*;
    import java.awt.Toolkit;
    import java.awt.Container;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import javax.swing.JScrollPane;
    import javax.swing.ScrollPaneConstants;
    import javax.swing.JTable;
    import javax.swing.JPanel;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    // sql imports
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.sql.PreparedStatement;
    import java.sql.Connection;
    import java.sql.DriverManager;
    public class SqlUtil extends JPanel
      Connection conn;  // database connection object
      Statement stmt;   // statement object
      ResultSet rslt;   // result set object
      // create someplace to put dat
      Vector data;     //    = new Vector();
      Vector columns;  //    = new Vector();
      Vector colHeads; //    = new Vector();     
      public SqlUtil()
        // setup panel
        JPanel sqlPanel = new JPanel(false);
        sqlPanel.setLayout(new BorderLayout());
        setBackground(Color.white);
        setForeground(Color.black);
      public void ExeSqlStmt(String sqlStmt, String columnNames[], String connectString, String userName, String password,int numColumns)
        data     = new Vector();
        columns  = new Vector();
        colHeads = new Vector();
        try
          // connect to database
          DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
          Connection conn = DriverManager.getConnection(connectString, userName, password);
          // select data into object
          stmt = conn.createStatement();
          rslt = stmt.executeQuery(sqlStmt);
          while (rslt.next())
            columns = new Vector();
            for ( int i=0; i<numColumns; i++ )
              colHeads.addElement(columnNames); // column heads
    columns.addElement(rslt.getObject(i+1)); // get the Object at i+1
    } // end for
    data.addElement(columns);
    // create the table
    JTable table = new JTable(data,colHeads);
    // add table to scroll pane
    int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
    int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
    JScrollPane jsp = new JScrollPane(table,v,h);
    // Add scroll pane to content pane
    add(jsp, BorderLayout.CENTER);
    // close the result set and close the statement
    rslt.close();
    stmt.close();
    } catch (SQLException ex)
    String msg = "SQL error: "+ex.toString();
    } catch (Exception ex)
    String msg = "Error: "+ex.toString();
    } // end constructor
    } // end SqlUtil class
    // then we have the code that is calling and getting the errors
    package jdba;
    // java imports
    import java.util.Vector;
    import java.awt.event.*;
    import java.awt.Toolkit;
    import java.awt.Container;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import javax.swing.JScrollPane;
    import javax.swing.ScrollPaneConstants;
    import javax.swing.JTable;
    import javax.swing.JPanel;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    // sql imports
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.sql.PreparedStatement;
    import java.sql.Connection;
    import java.sql.DriverManager;
    // rollback contention
    public class RollbackContention extends JPanel
    Connection conn; // database connection object
    Statement stmt; // statement object
    ResultSet rslt; // result set object
    //private vars
    private String userName = "[cut]";
    private String password = "[cut]";
    private String sid = "rob";
    private String port = "1521";
    private String server = "[cut]";
    private String connectString = "jdbc:oracle:thin:@"+server+":"+port+":"+sid;
    private int numCols = 3;
    private String sqlStmt = null;
    private String prompt = null;
    private String colNames[] = {"name","waits","gets"};
    // constructor
    public RollbackContention()
    SqlUtil exeStmt = new SqlUtil();
    sqlStmt = "select name, waits, gets";
    sqlStmt = sqlStmt + " from v$rollstat, v$rollname";
    sqlStmt = sqlStmt + " where v$rollstat.usn = v$rollname.usn";
    // here is the offending line.
    exeStmt.exeSqlStmt(sqlStmt, colNames[], connectString, userName, password, 3);
    // loop through and display the rollback segments

    In your call your referencing the array as colNames[] - it should be colNames (no []'s )
    exeStmt.exeSqlStmt(sqlStmt, colNames, connectString, userName, password, 3);

  • Syntax error on keyword "void"; "interface", "class" expected

    When migrating my application for Visual-Age to Web-Sphere 5.1
    The following error occurred:
    Syntax error on keyword "void"; "interface", "class" expected
    for the code:
    * ejbLoad method comment
    * @exception javax.ejb.EJBException The exception description.
    public void ejbLoad() throws javax.ejb.EJBException{
         _initLinks();
    }Thanking you in an advance

    I had missed a closing breacket '}'

  • Compiling Error... Found: Class Expected: Value

    Hello, I am writing a GUI with a "join file" feature.
    So far, I load my files (multiple files enabled):
    private void loadFile()
                 JFileChooser fc = new JFileChooser();
                  fc.setMultiSelectionEnabled(true);
                int returnVal = fc.showOpenDialog(MyFrame.this);
                   if (returnVal == JFileChooser.APPROVE_OPTION)
                       File[] files = fc.getSelectedFiles();
           }I join them by adding them into a vector (not sure if there's a better way?):
    public void joinFiles(File[] files)
                   Vector v = new Vector();
                   for (int i = 0; i<files.length; i++)
                       String fileName = new String(files.toString());
                   String line;
                        try
                             BufferedReader in = new BufferedReader(new FileReader(fileName));
                             if ( !in.ready() ) throw new IOException();
                                  while ( (line = in.readLine() ) != null)
                   v.add(line);
                        in.close();
                        catch (IOException e)
                        System.out.println(e);
    Then, as I have a GUI, I have menu item actions set up as follows:
    public void actionPerformed(ActionEvent e){
              if(e.getSource() == load){
                   loadFile();
              if(e.getSource() == join){
                   joinFiles(File[] files);
              }This generates the error:
    fileManipulator.java:93: '.class' expected
    joinFiles(File[] files);
    ^
    fileManipulator.java:93: ')' expected
    joinFiles(File[] files);
    ^
    fileManipulator.java:93: unexpected type
    required: value
    found : class
    joinFiles(File[] files);
    ^
    Help me please!!

    public class FileStuff {
        File [] fileArray;  //Declare as instance variable.
    private void loadFile()
        JFileChooser fc = new JFileChooser();
        fc.setMultiSelectionEnabled(true);
        int returnVal = fc.showOpenDialog(MyFrame.this);
        if (returnVal == JFileChooser.APPROVE_OPTION)
            //files IS NOT ACCESSIBLE OUTSIDE THIS "if" statement.
            File[] files = fc.getSelectedFiles();      // DELETE THIS
            fileArray = fc.getSelectedFiles();    // ADD THIS !!!!!!!
    public void joinFiles(File [] files)
    {  .. no change ..}
    public void actionPerformed(ActionEvent e)
    {  .. no change to "loadFile" part ..;
       if (e.getSource() = join)
          joinFiles(fileArray);
    }

  • "  ')' expected error..........

    i have defined a function, and the compiler is giving me "')' expected " error...
    here is my code
    package ab;
    import java.io.*;
    import java.util.*;
    import com.db4o.Db4o;
    import com.db4o.ObjectContainer;
    import com.db4o.ObjectSet;
    public class Test3 extends Util {
      public static void main(String[] args) {
         ObjectContainer db=Db4o.openFile(Util.DB4OFILENAME);
        try {
          BufferedReader in = new BufferedReader(new InputStreamReader(System.in));//USER INPUT KEYWORDS
              String the_query = in.readLine();     // READING KEYWORDS
         String[] arr = the_query.split (" ");     // SPLITTING USER KEYWORDS AND STORING IN ARRAY
              //****************************************************************************************ERROR LINE
               func(String p)                   
                       key ab = new key(arr[k]);
                        db.set(ab);
                        System.out.println(arr[k] + " is stored with 1st condition");
                        System.out.println("arr [k] is" + k+ " str[l] is" + l);
         // FETCHING DATA FROM DATABASE
         key proto = new key(null);
         ObjectSet result = db.get(proto);
         LinkedList ll2 = new LinkedList();
         while(result.hasNext()) {
         ll2.add(result.next());
         //System.out.println("retrieved linked list is" +ll2);
         String s = String.valueOf(ll2);
         int m = s.length()-2;
         String sub = s.substring(1,m);
         String [] str = sub.split(",");     // SPLITTING THE KEYWORDS
         int j = str.length;
         int g=0,h=0;
         String temp;
         h = str[0].indexOf('/');          // REMOVING THE "/" TO SEPERATE KEYWORD FROM HYPERLINK AND WEIGHT
         str[0]=str[0].substring(0,h);
         System.out.println("str[]0 is  "+ str[0]);
         for(int i=1; i<j;i++)
         g = str.indexOf('/');               // REMOVING THE "/" TO SEPERATE KEYWORD FROM HYPERLING AND WEIGHT
         str[i]=str[i].substring(1,g);
         System.out.println("str[]" i " is " + str[i]);
    //STORING DATA INTO DATABASE
    int l=0;
    int t = arr.length;
    System.out.println("arr[] length is " + t);
    System.out.println("str[] length is j" + j);
    for (int k=0; k < t; k++)
         {     l=0;
              for(l=0;l<=j;l++)
                   key(arr[k]);
              if(l+1> j)          // CHECKING IF AT THE END OF ARRAY
                        key ab = new key(arr[k]);
                        db.set(ab);
                        System.out.println(arr[k] + " is stored with 1st condition");
                        System.out.println("arr [k] is" + k+ " str[l] is" + l);
              else if((arr[k].equals(str[l]))) {          // CHECKING IF THE TWO STRINGS MATCHES OR NOT
                        System.out.println("arr [k] is" + k+ " str[l] is" + l);
                        System.out.println("Comparing " + arr[k] + "//////////" + str[l]);
                        System.out.println(arr[k]+ " STRING ALREADY PRESENT");
                        System.out.println(" 3rd condition");
                        k++;
                        l= -1;
                        System.out.println("due to 3rd condition now arr [k] is" + k+ " str[l] is" + l);
                   else          // NOT DOING ANYTHING
                        System.out.println("not doing anything");
                        System.out.println("arr [k] is" + k+ " str[l] is" + l);
                        System.out.println("Comparing " + arr[k] + "//////////" + str[l]);
              /* BufferedReader in2 = new BufferedReader(new InputStreamReader(System.in));//USER INPUT HYPERLINK
    BufferedReader in3 = new BufferedReader(new InputStreamReader(System.in));//USER INPUT WEIGHT
                   String hyp = in.readLine();     // READING HYPERLINKS
              String weight1 = in.readLine(); //READING WEIGHT
              int weight = Integer.parseInt(weight1);
              for(int c=0;c<t;c++)
              hyp h1 = new hyp(arr[c],weight);
                   ab.sethyper(h1);
                   db.set(ab);
    in.close();
    //in2.close();
    //in3.close();
    } catch (IOException ioe)
    { ioe.printStackTrace();
         db.close(); }
    and the error is .....C:\Documents and Settings\Sumit\Desktop>javac ab/Test3.java
    ab/Test3.java:22: ')' expected
    func(String p)
    ^
    1 error

    cotton.m wrote:
    cotton.m wrote:
    ping.sumit wrote:
    thanks abillcons!.... i got itGot what exactly?
    Because that won't fix the multitude of problems you have that I listed...Because to be honest with you ping it's pretty annoying that I took the time to look at your code in depth, which Bill
    did not do, and list all the problems you have there and you just want to pretend that adding a return type to a
    method signature in the middle of another method fixes this problem. Certainly a missing return type is a problem in
    a method signature, but when the "method" in question is in the midst of another method and uses variables local
    to the other method, never mind a slew of other variables that are never declared anywhere... well it's not really the
    only problem and certainly fixing it did not make you "get" it. Whatever "it" may be.
    What a waste of time it was helping you. I won't make that mistake again to be sure.Yes you did do more work than I. But I answered his direct and immediate question. I had no intention of stopping there if and when the pgm still did not work. I answered the immediate question, then others went on to add greater depth. It's always a disappointment when one does not seem to receive due credit - and we've all been there. Thats partly why I tried to bring the OP's attention back to my post as well, because it seemed that's what was occurring there too.
    But I also see that many times folks get stuck on a point they are trying to solve and become frustrated to the point of distraction at times - so I think it's best to cut them some slack.
    There has been a real rash of posters that don't come through either with dukes, thanks or even acknowledgments lately ... I hope this OP will not be one of them - I don't see that that is the case thus far.

  • Java '.class' expected, simple but im not seeing it

    I'm working on a project right now and need to list 3 parellel arrays. This is what my compiler error looks like.
    '.class' expected ')' expected
    It's really bugging be, so here are the two methods.
    This is the code that my info is being sent to. This method is in a class named ListPets
    public void listPets(String[] name, double[] price, int[] quanity)
              for(int i = 0; i<name.length; i++)
                   output+="\n"+name[i]+"       "+price[i]+"          "+quanity;
    this is what is being sent to it
    This code is in a class called MainGui
    I also have this little bit at the top.
    ListPets panList = new ListPets();
         public void actionPerformed(ActionEvent ae)
         panList.listPets(petname[], petprice[], petquanity[]);
    }I feel like im over looking somthing, but i cant find it. Any help on this would be nice, thanks,

    panList.listPets(petname[], petprice[] , petquanity[]);You are trying to call a method in the line of code above. So you should only include the variable names, like thispanList.listPets(petname, petprice, petquanity);Some feedback on your design: It looks like you have (at least) 3 arrays whose contents relate to each other. That is, petname[2] is a pet type's name, petprice[2] is the same pet type's price and petquantity[2] is the same pet type's quantity. In Java, you should not use "parallel arrays" to associate the contents of arrays. Instead, you should have a class - that's the whole idea of object oriented programming.

  • '.class' expected

    import java.lang.String;
    class StringDemo
    public static void main(String args[])
      //create 3 strings
      String s1="This is Dog";
      String s2= new String(" I LIke It");
        char arr[]={"l","a","k","s","h","m","i"};
        String s3= new String(arr[]);
       //display the strings
      System.out.println("s1="+s1);
       System.out.println("s1="+s2);
       System.out.println("s1="+s3);
       //find no'of characters in s1
       System.out.println(" Length ofs1="+s1.length());
      //join s1 with s2
       System.out.println("s1 joined with s2="+s1.concat(s2));
      //join 3 strings using +
       System.out.println(s1+"at="+s3);
      //test s1 starts with this or not
      boolean x=s1.startsWith("This");
      if(x==true)
      System.out.println("starts with thiss1=");
      else
       System.out.println(" notstart ");
    //extract substrings from s2 and s3
    String p=s2.substring(0,5);
      String  q=s3.substring((0));
       System.out.println(p+q);
    //convert the case of s1
    s1.toUpperCase();
      System.out.println("Lower of s1="+s1);
    s1. toLowerCase();
    Hi, when i compile this program it gives an error like
    StringDemo.java:10: '.class' expected
        String s3= new String(arr[]);
                                   ^
    StringDemo.java:10: ')' expected
        String s3= new String(arr[]);what's my mistake pls helpme
    ThanQu in advance

    import java.lang.String;
    class StringDemo
    public static void main(String args[])
    //create 3 strings
    String s1="This is Dog";
    String s2= new String(" I LIke It");
    char arr[]={"l","a","k","s","h","m","i"};
    String s3= new String(arr[]);This should be:
    String s3 = new String(arr);
    if(x==true)Although the above will work, you should not do this as a matter of style (it is redundant). Should be:
    if (x) {
    }

  • Object expected error

    i have written a jsp with other jsp included inside it.
    i am accessing the javascript function present in the outer jsp by the inner jsp <href: javascript........> tag . i am getting object expected error of javascript. any suggestions plz.
    thanks

    its a very big files. i dont think i can paste.. anyways i try . TY
    included jsp
    <%--
    --%>
    <%@ page language="java" import="java.lang.*,java.util.*" %>
    <%@ page buffer = "32kb" %>
    <%@ page import="com.wolterskluwer.atlas.crn.CRNSearcherConst"%>
    <%@ page import="com.wolterskluwer.eip.crn.PortalHelper" %>
    <%@ page import="com.wolterskluwer.eip.crn.MonitorManager" %>
    <%@ page import="com.wolterskluwer.eip.crn.TrackerSort" %>
    <%@ page import="com.wolterskluwer.eip.common.tools.log.Log" %>
    <%@ taglib uri="documentProvider.tld" prefix="dp" %>
    <%@ taglib uri="documentCache.tld" prefix="dc" %>
    <%@ taglib uri="diag.tld" prefix="diag" %>
    <%@ taglib uri="oscache.tld" prefix="oscache" %>
    <jsp:useBean id="userProfile" type="com.wolterskluwer.eip.crn.beans.UserProfile" scope="session" />
    <%
         MonitorManager monMan;
         monMan = (MonitorManager) request.getAttribute("monMan");
    %>
    <%-- define link for help page --%>
    <%
    StringBuffer mycrn_helplink = new StringBuffer(64);
    mycrn_helplink.append("javascript:reSetTimerTop(),displayPopupWindow('" + PortalHelper.getContextWebHelpURL("Publications-search.htm") + "'," + (String)application.getAttribute(CRNSearcherConst.APPLICATION.HELPPAGES_DIMENSIONS) + ")");
    //     check if it is content viewer header,
    //     which is a litte bit diferent then other crn headers
    boolean isContentViewerHeader = false;      
    if(request.getParameter("contentViewerHeader") != null &&
      request.getParameter("contentViewerHeader").compareTo("true") == 0){
         isContentViewerHeader = true;    
    %>
              <!-- TOP MATTER -->
              <DIV id="top-matter">
                   <DIV class="top-left-col">
                        <jsp:include page="../siteid.jsp" />
                   </DIV>
                   <DIV class="top-middle-col">
                       <jsp:include page="headermiddlecol.jsp" />                        
                   </DIV>
                   <% if (!isContentViewerHeader){ %>                    
                        <jsp:include page="../ssouserprofileproductaccess.jsp" />
                   <% } %>     
                   <DIV id=search-strip>
                        <% if (!(request.getParameter("doNotShowSearchStrip") != null && request.getParameter("doNotShowSearchStrip").compareTo("true") == 0)){ %>
                      <DIV class=left-col>
    <%-- --%>                       
                  <% Log.debug("crn_mainheader.jsp: before using cache tag"); %>
              <% Log.debug("crn_mainheader.jsp: key=[request.cachekey_userid]; request.cachekey_userid=[" + request.getAttribute("cachekey_userid") + "]"); %>
              <% String key = "CrnMainHeader"+userProfile.getUserId()+request.getAttribute("ignoreaccessrights");%>
              <% Set keyList = (Set) application.getAttribute("CacheKeyList");
                   if(keyList!=null) {
                        keyList.add(key);
                        application.setAttribute("CacheKeyList", keyList);
              %>
              <oscache:cache key="<%=key%>" scope="application" groups="<%=userProfile.getUserId()%>" refresh="<%=PortalHelper.getWebCacheRefresh()%>">
                   <% Log.debug("CRN cache: [crn_mainheader.jsp].[globalnavdropdown] - is recalculating"); %>
                   <% monMan.start("WSCRN.MyCRN.Header.GlobalNavCategory (XSLT)"); %>         
                   <dp:documentProvider id="globalNavCategory" scope="page" pagerId="htmlPager">
                        <dc:cacheDocument cacheName="<%= CRNSearcherConst.APPLICATION.EXTENTED_CSH_DOCUMENTPROVIDER_CACHE %>">
                             <csh:cshextract DOMDocumentID="<%= CRNSearcherConst.APPLICATION.EXTENDED_CSH_DOM_ID %>" DOMDocumentScope="application"/>
                        </dc:cacheDocument>
                        <%-- apply xsl filter to get rid of unsubscribed nodes --%>
                        <dp:xmlTransform isXSLTFilterEnabled="true"
                                             xslFileUri="<%= PortalHelper.getCSHFilterXSLFileUrl() %>"
                                             >
                             <dp:xmlParam name="subscribedProductsAssm" value="<%= userProfile.getProductsSubscribedAssm() %>" />
                             <dp:xmlParam name="listItemSeparator" value="<%= userProfile.LISTITEM_SEPARATOR %>" />
                             <dp:xmlParam name="showUndefinedPubs" value="false" />
                             <dp:xmlParam name="nav-type-toShow" value="Global" />
                             <%-- diagnostic mode when access rights have to be ignored --%>
                             <diag:paramCheck name="<%= CRNSearcherConst.DIAG.IGNOREACCESSRIGHTS %>" value="on">
                                <dp:xmlParam name="showNotSubscribedPubs" value="true" />
                            </diag:paramCheck>
                           </dp:xmlTransform>
                        <%-- generate drop-down box with only subscribed nodes that have attribute nav-type equal to Global --%>
                        <dp:xmlTransform isXSLTFilterEnabled="true" xslFileUri="<%= PortalHelper.getGlobalNavigationDropDownXslFile() %>"
                                             dtdUri="<%= PortalHelper.getDTDUrl(PortalHelper.getAssembliesCollectionId()) %>" >
                             <dp:xmlParam name="CRNSearcherConst.URL.GLOBAL_NAV_PATH" value="<%= CRNSearcherConst.URL.GLOBAL_NAV_PATH %>" />
                             <dp:xmlParam name="CRNSearcherConst.URL.GLOBAL_NAV_LINK" value="<%= CRNSearcherConst.URL.GLOBAL_NAV_LINK %>" />
                             <%-- diagnostic mode when access rights have to be ignored --%>
                             <diag:paramCheck name="<%= CRNSearcherConst.DIAG.IGNOREACCESSRIGHTS %>" value="on">
                                  <dp:xmlParam name="ignoreaccessrights" value="true" />
                             </diag:paramCheck>
                        </dp:xmlTransform>
                   </dp:documentProvider>
                   <% monMan.stop("WSCRN.MyCRN.Header.GlobalNavCategory (XSLT)"); %>
                   <form name="sites" style="margin-top: -2px;margin-left:5px;">
                        <select name="browseCRN" onchange="goToURL()">
                             <option value="0" selected>Browse the CRN...</option>
                             <option value="mycrn.jsp">My CRN</option>
                             <%
                             List trackerCatList = (List) application.getAttribute("TrackerCategoryList");
                             String prodSub = userProfile.getProductsSubscribed();
                             if(TrackerSort.hasTrackerSubscribed(trackerCatList, prodSub)) {
                                  %><option value="mytracker.jsp">My Trackers</option><%
                             %>
                             <%-- display dynamic global navigation options --%>
                             <dp:displayPage ifInPlaceThenDisplay="true" scope="page" documentProviderId="globalNavCategoryDocumentProvider" />
                        </select>
                   </form>
              </oscache:cache>                            
    <%-- --%>                       
                            <IMG height=17 alt="" src="../img/label_search.gif" width=50>
                       </DIV>   
                      <DIV class=middle-col style="width:330px;">
                                  <% monMan.start("WSCRN.MyCRN.SimpleSearchDisplay-searcher.AllFile"); %>
                                  <jsp:include page="../search/searcher/simpleSearchDisplay-searcher.jsp">
                                       <jsp:param name="<%= CRNSearcherConst.URL.FORM_ACTION_URL %>" value="<%= CRNSearcherConst.JSPFILES.SEARCHRESULTS_PAGE %>" />
                                       <jsp:param name="<%= CRNSearcherConst.URL.SEARCHMASKFORM_HIDDEN_FIELD %>" value="<%= CRNSearcherConst.JSPFILES.SIMPLESEARCH_MODULE %>" />
                                  </jsp:include>
                                  <% monMan.stop("WSCRN.MyCRN.SimpleSearchDisplay-searcher.AllFile"); %>
                        </DIV>
                        <%-- modifed PM 1/4/2006 --%>
                      <DIV class=right-col
                           style="
                           <% if(isContentViewerHeader){ %>
                                position: absolute;top: -45;right: 2;text-align:right;width:580px;padding:0px;margin:0px;     
                           <%}else{%>
                                margin-top:-1px;text-align:left;margin-left:0px; 
                           <%}%>">
                             <% if (isContentViewerHeader){ %>                    
                                  <jsp:include page="../ssouserprofileproductaccess.jsp" />
                             <% } %>                                
                           <% if (!(request.getParameter("doNotShowSearchHelp") != null && request.getParameter("doNotShowSearchHelp").compareTo("true") == 0)){ %>                      
                           <A href="<%= mycrn_helplink.toString() %>" target="_top" style="margin-left:3px;margin-right:3px;">Search Help</A>|<%}%><A href="advancedsearch.jsp" target="_top" style="margin-left:3px;margin-right:3px;">Advanced Search</A>|<A href="<%= CRNSearcherConst.JSPFILES.RULESEARCH_MODULE %>" target="_top" style="margin-left:3px;margin-right:3px;">Rule Search</A>|<A href="savedsearches.jsp" target="_top" style="margin-left:3px;">My Searches</A>
                      </DIV>   
                      <% } %>                                   
                    </DIV>       
              </DIV>
    <%--  main jsp--
    <%--
    <%@ page language="java" %>
    <%@ taglib uri="diag.tld" prefix="diag" %>
    <%@ page import="com.wolterskluwer.eip.crn.PortalHelper" %>
    <%@ page import="com.wolterskluwer.eip.crn.MonitorManager" %>
    <%
         MonitorManager monMan = new MonitorManager();
         monMan.start("WSCRN.ContentViewerTop.TotalTime");
         request.setAttribute("monMan",monMan);
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <HEAD>
    <TITLE>content-viewer-top.html</TITLE>
    <!-- characterset is set to ISO-8859-1 to match encoding in docview.xsl that generates document in ISO-8859-1 encoding -->
    <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <link rel="stylesheet" type="text/css"  href="../css/content-viewer_screen.css"/>
    <link rel="stylesheet" type="text/css" href="../css/global.css">
    <script language="javascript" type="text/javascript" src="../jscript/contentviewer.js"></script>
    <script type="text/javascript">
    var oImgExpand = new Image;
    oImgExpand.src = "../img/toc_expand.gif";
    var oImgCompact = new Image;
    oImgCompact.src = "../img/toc_compact.gif";
    function toggleExpand(){
         oFrameset = parent.document.getElementById("framesContent");
         oImg = document.getElementById("toc-button");
         oBut=document.getElementById("s_h_button");
         if (oImg.src.indexOf("img/toc_expand.gif")>-1){
              oImg.src = oImgCompact.src;
              oFrameset.cols = strTemp;
              oBut.value="Hide TOC";
         }else{
              strTemp = oFrameset.cols;
              oImg.src = oImgExpand.src;
              oFrameset.cols = "0,*"; //changed from 192 to 0 by artp
              oBut.value="Show TOC";
    function OpenWindow(strURL, strName, intWidth, intHeight,toolbar){
         objPopUp = open( strURL, strName, "toolbar="+toolbar+",width="+intWidth+",height="+intHeight+",scrollbars=yes,resizable=yes,menubar=yes,personalbar=yes,location=yes");
         //reSetTimerTop();
    function printContent(){
         parent.frameRight.print();
    </script>
    <script type="text/javascript" src="../jscript/minmax.js"></script>
    </HEAD>
    <BODY>
    <DIV id="content-viewer-top-stretch">
         <jsp:include page="../WEB-INF/jspinclude/mainparts/crn_mainheader.jsp" >
              <jsp:param name="contentViewerHeader" value="true"/>
         </jsp:include>
    </div>
    <div id="content-viewer-top">
         <% monMan.start("WSCRN.ContentViewerTop.ContentViewerHeader"); %>
         <jsp:include page="/WEB-INF/jspinclude/contentviewer/contentviewerheader.jsp" />
         <% monMan.stop("WSCRN.ContentViewerTop.ContentViewerHeader"); %>
    </div>
    </BODY>
    </HTML>
    <% monMan.stop("WSCRN.ContentViewerTop.TotalTime"); %>
    <diag:paramCheck notName="showtime">
    <%
         out.print("<!--");
         out.print(monMan.report("\n"));
         out.print("-->");
    %>
    </diag:paramCheck>
    <diag:paramCheck name="showtime" value="on">
    <%
         out.print(monMan.report("<br>"));
    %>
    </diag:paramCheck>Message was edited by:
    bobz

  • [Test(expects="Error")] not functioning as expected

    When testing against implementation code which is expected to throw an exception the test fails even when the expected exception is thrown.
    I broke this test down into a very simple example to help illustrate the issue:
    public class ExpectsExampleTest
        [Test(expects="Error")]
        public function testExpects():void
            throw new Error();
    The above code result in the following error:
    6/11/2009 23:23:39.519 [WARN] FlexUnit4 There was 1 failure:
    6/11/2009 23:23:39.522 [WARN] FlexUnit4 1 tests::ExpectsExampleTest.testExpects Error
    Not sure if I am missing something or not, however the implementation appears to be correct.
    Thanks,
    Eric

    mlabriola wrote:
    Eric,
    there was a bug surrounding this issue. Latest bits in SVN should have it corrected. There was a difference between the docs and code.
    if you get the latest, it will work as is, or, you can change the word expects to expected and it will likely work in yours.
    It the new version it accepts either,
    Mike
    thanks mike, you're right

  • AVL tree type expected error

    the line tree.addElement( new Integer(3)); gives me type expected error. why does this happen?
    import jds.collection.AVLTree;
    public class printOut extends AVLTree
    public static void main(String args[])
    AVLTree tree = new AVLTree(test);
    tree.addElement( new Integer(3));
    Enumeration e = tree.elements()
    while (e.hasMoreElements())
    data.setElementAt(e.nextElement(), i++)
    System.out.println(tree.toString());
    }

    What is the type of test?

Maybe you are looking for

  • Integer parameters not acceptible in WHERE clause with TO_DATE function.

    Please tell me why the following query is not acceptible in a BI Publisher (11.1.1.5) data set. SELECT * FROM all_tables WHERE LAST_ANALYZED >= TO_DATE(:yyyy || '-' || :startmo || '-' || :startday, 'YYYY-MM-DD') AND LAST_ANALYZED < TO_DATE(:yyyy || '

  • Add BatchNumbers Purchase Invoice

    Hi How is it possible to include data from the Purchase Invoice lot before the user saves it? I Need fulfill the batch data automatically while the user is still entering the Purchase Invoice

  • #error in formula row of the form sum([1])/2

    Greetings! I have a necessity to use formula row in some forms to get an aggregated value of rows above, sometimes i have to use sum([1])/2 and this results me into a problem: in cells where formula is not valid (all values in specific column are bla

  • Questions before I SWITCH to Mac...

    Few questions before I switch to Mac (hoepfully when Leopard comes out).... Currently I have a Dell XPS Media Center PC and a Vista laptop. 1. TV/DVR CAPABILITIES: I love using my PC as a tv tuner & DVR. Does mac have this capability? If I run Vista

  • Why won't LR 3 load all the images in a cataloged file?

    When I try to open a folder or collection of images (in Library, grid view), some of the images load right away, others take several seconds, and some never load. Instead I see gray boxes, albeit with the proper DSC number in the upper right corner o