'.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[];
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:
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.

Similar Messages

  • -251723760 CIP Error when trying to read and array of sgl from and AB ControlLogix PLC

    I have the NI Ethernet/IP module to communicate with an Allen-Bradley ControlLogix PLC. I am doing both reading (only 13 values) and writing (over 200 values). I am using the basic ethernetip tag write.vi to  do the writing. These program are in an executable running on a 'run-time' machine. I have the list of tagnames I am reading and writing to and have confirmed with the person who created the AB load that the array I am writing to on the AB side has more than enough addresses (it is an array of length 300). However I am only able to write 118 values to it. When trying to write 119 or more I get the error:
    -251723760 CIP error - extended status may be available
    I have confirmed with NI OPC Servers with an OPC quick client (running on my development PC) connected to the AB ControlLogix that the values I am writing to up to element 118 are getting through correctly, i.e. if I write 123.456 to sample_array[13] then I in fact see this same value at that location in the OPC quick client.
    To be honest I am a little disappointed that the error message is so cryptic and gives no hints as to what troubleshooting paths are possible. I have tried various combinations of group/tag names with and w/o offsets, e.g. [3], but nothing has led me any further.

    Thanks for the quick response - here are screenshots of before (write OK - writing 118 values - all except last are 0) and after (error - when trying to write an array of length 119) as well as the simple test program I as using.
    NI Ethernet_IP 3-20-2013 Troubleshooting.zip ‏90 KB

  • PLS-00201 error when trying to pass an OUT parameter

    Please help me to resolve the below error:
    I am trying to pass an OUT parameter in a package.
    I have declared it in package specs as
    ProcABC(p_val IN varchar2, p_val2 IN varchar2, p_val3 OUT varchar2)
    In package body
    I have created the procedure as
    Create or Replace procedure ProcABC(p_val IN varchar2, p_val2 IN varchar2, p_val3 OUT varchar2) AS
    v_LogDir varchar2(40);
    v_message varchar2(200);
    SELECT directory_path into v_LogDir FROM ALL_DIRECTORIES WHERE directory_name = 'ABC';
    v_message := v_LogDir ;
    some sql statements..
    p_val3 := v_message;
    Return p_val3;
    End procABC;
    SQL> exec pkg_A.procABC('Stage2', NULL, p_val3);
    Package compiles successfully but while execution it returns error as:
    ORA-06550: line 1, column 74:
    PLS-00201: identifier 'p_val3 ' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Please advise.

    Hi Suresh,
    Thanks for the information and help. I was able to run the package with this usage.
    Now, the issue is
    I need to return a v long string by the OUT parameter so I defined the datatype of OUT parameter as CLOB.
    But, when I declare local variable to run the package with this OUT paramater I get the error :
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at line 1
    When I pass a shorter string it works.
    Kindly advise me how to resolve this issue while using CLOB as datatype of OUT parameter.

  • Error when trying to pass the proxy server

    jdev version:
    Oracle Database 10g Enterprise Edition Release - Prod
    PL/SQL Release - Production
    TNS for Linux: Version - Production
    i've follow a tutorial to make a client to consume e web service in forms.
    i must work through a proxy server.
    here is the jdev code:
    public class PrimeNumbersStubnew extends WrappedDocLiteralStub
    public PrimeNumbersStubnew()
    m_httpConnection = new OracleSOAPHTTPConnection();
    Properties props = new Properties();
    props.put(OracleSOAPHTTPConnection.PROXY_HOST, "");
    props.put(OracleSOAPHTTPConnection.PROXY_PORT, "8070");
    props.put(OracleSOAPHTTPConnection.PROXY_AUTH_TYPE, "basic");
    props.put(OracleSOAPHTTPConnection.PROXY_USERNAME, "XXXXX");
    props.put(OracleSOAPHTTPConnection.PROXY_PASSWORD, "XXXXX");
    +private String _endpoint = "http://www50.brinkster.com/vbfacileinpt/np.asmx";+
    public String getEndpoint()
    And a receive an error when i execute the forms:
    +Exception: java.lang.Exception: [SOAPException: faultCode=SOAP-ENV:Protocol; msg=Unsupported response content type "text/html; charset=utf-8", must be: "text/xml". Response was:+
    +<TITLE>Access Denied</TITLE>+
    +<FONT face="Helvetica">+
    +<TABLE border=0 cellPadding=1 width="80%">+
    +<FONT face="Helvetica">+
    +<big>Access Denied (authentication_failed)</big>+
    +<FONT face="Helvetica">+
    +Your credentials could not be authenticated: "Credentials are missing.". You will not be permitted access until your credentials can be verified.+
    It's like the credential were bad but i'm sure that they are correct.
    How can i do to resolve that?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    I've tested and it change nothings.
    I've try to put the property "ALLOW_USER_INTERACTION" and it work fine.
    It ask for user and pass and after it work.
    I don't understand why when i put that property it work.
    Properties prop = new Properties();
    prop.setProperty(OracleSOAPHTTPConnection.PROXY_HOST, "");
    m_httpConnection = new OracleSOAPHTTPConnection(prop);
    A thing that i see with that prop, is that we use a Realm but even if i put the realm, the error is still there.
    Here are the screens that the property show me:
    <img src="http://www.imageshotel.org/thumbs/Malebodja/setcookierequest.jpg" alt="hébergé sur http://www.imageshotel.org/" />
    <img src="http://www.imageshotel.org/thumbs/Malebodja/authorizationrequest.jpg" alt="hébergé sur http://www.imageshotel.org/" />
    Any suggestions?
    Edited by: Malebodja on Feb 24, 2010 2:39 AM
    Edited by: Malebodja on Feb 24, 2010 2:40 AM

  • .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);

  • identifier expected error when trying to create a class instance?

    public static Time time;
    //Cannot find symbol package1.Controller - both have the same package statement.
    //When the 2nd line is included ony that is flagged as giving an error
    //Gives <identifier> expected
    public static Time time;
    time = new Time();
    //Simply typing:
    time = new Time();
    //does too
    The classes look like:
    package package1;
    public class Controller extends Applet
    public static Time time;
    time = new Time();
        public void init()
         this.setLayout(new FlowLayout());
         Panel panel = new Panel();
        public void paint()
         //Some stuff here
    package package1;
    import java.awt.*;
    import java.io.*;
    public class Time extends Panel implements Runnable
        public static Panel timeP;
        public Time() {timeP = new Panel();}
         //Some other unrelated stuff here

    Sorry, i forgot about that.
    public static Time time = new Time();/*Gives
    cannot find symbol
    symbol: class Time
    location class package1.Controller
    cannot find symbol
    symbol: class Time
    location class package1.Controller
    It looks like it's looking for the Time class in the Controller class?

  • ORA-01722: invalid number error when trying to pass a list of values

    We are using a function like so
    The usage for the function below is
    Select fn_st_bb_nm_uc (‘1232131312, 123213312’) from dual;
    SQL> /
    Select fn_st_bb_nm_uc ('1232131312, 123213312') from dual
    ERROR at line 1:
    ORA-01722: invalid number
    It’s giving an invalid number error. When we pass one value it is working fine but when we pass a string of values it gives this error. I have opened an SR around this but would greatly appreciate your help
    Acc_blackbar is the table and acc_blkbr_id is of type number.
    FUNCTION fn_st_bb_nm_uc (pBB_ID_LIST VARCHAR2)
    vspcm_typ_nm_uc VARCHAR2 (2000);
    CURSOR stname
    SELECT distinct st.spcm_typ_nm_uc
    acc_blackbar abb,
    acc_specimen_type ast, acc_procedure apr,
    acc_specimen_part asp,
    specimen_type st, procedure pr,
    proc_proc_family ppf
    AND apr.procdr_id = pr.PROCDR_ID
    AND abb.acc_blkbr_id in (pBB_ID_LIST) ;
    FOR st IN stname
    vspcm_typ_nm_uc := vspcm_typ_nm_uc || ',' || st.spcm_typ_nm_uc;
    vspcm_typ_nm_uc := SUBSTR (vspcm_typ_nm_uc, 2);
    RETURN vspcm_typ_nm_uc;

    This ask tom thread covers multiple solutions:

  • Passing data from JavaScript to Applets (Error when trying to pass data)

    I've wrote a small applet for lists but when I try to pass data from my
    JavaScript to my applet, I get an "Error: Object doesn't support this property or method". I get this error with a select other sites including the page I'm writing, leading me to believe I may not have installed requried files or set required options. I've included the listing of the code snippet where the error occurs.
    document.listApplet.testMethod()OR when I use:
    document.applet(listApplet).testMethod()The applet is loaded by this statement:
    <OBJECT CODE="CustomAppletList" NAME="listApplet" ID="listApplet" WIDTH="1000" HEIGHT="600"></OBJECT>and loads fine but no data is passed through it's public methods. Can anyone suggest ideas how I can successfully pass data from my JavaScripts to my applets?

    this should work for you. In your javascript do this.
    var myApplet=document.listApplet;
    If you need more help let me know.


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%@ page import="XYZ.*" %>
    SMUA sndmail = new SMUA();
    sndmail.postMail ("[email protected]","Test Subject","What Message","[email protected]");

    Dude. Please don't shout. If your keyboard is like mine, it can produce both upper and lower case letters. Please use them appropriately.
    Do you have the activation.jar/mail.jar available in the WEB-INF/lib directory for this application?

  • Error when trying to check an array

    hi  i am trying to make a game that the score is calculated based on which objects you pick up from the stage. I am having trouble outputting them to the stage.
    I have assigned the symbols from the library using the code below:               
    public function newObject(e:Event)
                                                    var goodObjects:Array = ["WordObject1"];
                                                    var badObjects:Array = ["WordObject2"];
                                                    if (Math.random() < .5)
                                                                    var r:int = Math.floor(Math.random()*goodObjects.length);
                                                                    var classRef:Class = getDefinitionByName(goodObjects[r]) as Class;
                                                                    var newObject:MovieClip = new classRef();
                                                                    newObject.typestr = "good";
                                                    } else
                                                                    r = Math.floor(Math.random()*badObjects.length);
                                                                    classRef = getDefinitionByName(badObjects[r]) as Class;
                                                                    newObject = new classRef();
                                                                    newObject.typestr = "bad";
                                                    newObject.x = Math.random();
    I then try to display these on the stage using the following code:
    // create random Word objects
                                    public function placeWords() {
                                                    objects = new Array();
                                                    for(var i:int=0;i<numWordObjects;i++) {
                                                                    // loop forever
                                                                    while (true) {
                                                                                    // random location
                                                                                    var x:Number = Math.floor(Math.random()*mapRect.width)+mapRect.x;
                                                                                    var y:Number = Math.floor(Math.random()*mapRect.height)+mapRect.y;
                                                                                    // check all blocks to see if it is over any
                                                                                    var isOnBlock:Boolean = false;
                                                                                    for(var j:int=0;j<blocks.length;j++) {
                                                                                                     if (blocks[j].hitTestPoint(x+gamesprite.x,y+gamesprite.y)) {
                                                                                                                     isOnBlock = true;
                                                                                    // not over any, so use location
                                                                                    if (!isOnBlock) {
                                                                                                     newObject.x = x;
                                                                                                     newObject.y = y;
    I get 3 errors,
    Line 119
    1119: Access of possibly undefined property x through a reference with static type Function.
    Line 120
    1119: Access of possibly undefined property y through a reference with static type Function.
    Line 122
    1067: Implicit coercion of a value of type Function to an unrelated type flash.display:DisplayObject.
    any help much appreicated.

    public function newObject(.... <-- newObject is a function. You're using it like a variable on those lines, e.g. newObject.x = x; You can't do that.
    newObject = new classRef(); <--- very bad to use a variable name that is the same as a function that exists. Change the name of that variable and the compiler won't be confused. Make sure you even have scope access to the variable in the other function as well. I don't see you obtaining a reference to the variable 'newObject' by getting it off the display list or you creating any new variable in that function at all with that name, so naturally flash thinks 'newObject' means the function, not a variable.

  • Error when trying to register an array as output

    i have a bea-weblogic 5.1 with JDK 1.2.1.
    i try to register an array output param, but when the code comes to:
    cstmt.registerOutParameter(1,types.ARRAY, "TYPE_STRING_ARRAY");
    i get a AbstractMethodError. How comes this?

    public function newObject(.... <-- newObject is a function. You're using it like a variable on those lines, e.g. newObject.x = x; You can't do that.
    newObject = new classRef(); <--- very bad to use a variable name that is the same as a function that exists. Change the name of that variable and the compiler won't be confused. Make sure you even have scope access to the variable in the other function as well. I don't see you obtaining a reference to the variable 'newObject' by getting it off the display list or you creating any new variable in that function at all with that name, so naturally flash thinks 'newObject' means the function, not a variable.

  • Keep getting VncViewer.class not found error when trying to use Windows 7

    I have no issue accessing the OVM Manager 2.2 with OEL 5.4 x86_64 with the latest Java release from ULN. But when I use a Windows 7 client ( x86) with the Sun Java 6 Update 18 I get the following error when trying to access the Console of a VM Guest:
    Java Plug-in 1.6.0_18
    Using JRE version 1.6.0_18-b07 Java HotSpot(TM) Client VM
    User home directory = C:\Users\deverej
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    load: class VncViewer.class not found.
    java.lang.ClassNotFoundException: VncViewer.class
         at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: open HTTP connection failed:
         at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
         at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
         at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         ... 7 more
    Exception: java.lang.ClassNotFoundException: VncViewer.class
    I am curious fi I should use only a specifc Java Engine with IE 7 or the latest Firefox browers.

    Same issue to with Windows XP SP3 x86 with Java Runtime Enviornment 1.5.0_15
    J2SE Enviornment 5.0 Update 15
    Java 6 Update 17

  • Portal runtime error when trying to create new Iviews in EP

    Require an Urgent help
    getting portal runtime error when trying to create a new iView in portal. I am unable to create a single iView  in portal.
    It was working before please see this error message
      Portal Runtime Error
    An exception occurred while processing a request for :
    iView : com.sap.portal.appintegrator.sap.WebDynproPageBuilder
    Component Name : com.sap.portal.appintegrator.sap.WebDynproPageBuilder
    Error occurs during the rendering of jsp component.
    Exception id: 05:20_12/01/08_0004_17115850
    See the details for the exception ID in the log file
    AM Iworking on NW2004s sp11. I was able to create iViews on this system before
    let me know where to check the log file also. Points will be awarded
    Thank you
    Krishna Kanth
    Edited by: siddi siddi on Jan 13, 2008 12:05 AM

    Krishna Kanth,
    logs can be read from nwa, if you hv the relevant access or get portal admin to pass the defaulttrace file to you. Login to nwa, navigate to Monitoring-Logs and traces and select (either default trace or last 24hrs) to view the logs. hope this helps

  • I am getting a 404 error when trying to access any search link using google, I can get to a website if I enter the url directly.  I have cleared my history, emptied the cache and reset safari.

    I keep getting a 404 error when trying to access any search link using google, I can get to a website by directly using the URL.  I have cleared history, empited the cache and reset safari.  Any suggestions.

    Right. If you are using delegated privs and sudo, make sure that sudo is configured to pass on the PERL5LIB and ORACLE_HOME environment variables at least.

  • Getting Error when trying to connect to the Primavera database. PPM V7 SP3

    Hi Guys,
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mailService' defined in class path resource [com/primavera/bre//com/primavera/bre/integration/intgconf.xml]: Invalid destruction signature; nested exception is org.springframework.beans.factory.support.BeanDefinitionValidationException: Couldn't find a destroy method named 'destroy' on bean with name 'mailService'
    I have looked into the intgserver.jar under P6IntegrationAPI/lib and looked the com.primavera.infr.srvcs.MailServiceImpl.java and can see that there is no destroy method whereas it is defined in the com.primavera.bre.intergration.intgconf.xml as below
    <!-- provides mail services -->
    <bean id="mailService" class="com.primavera.infr.srvcs.MailServiceImpl" init-method="init" scope="singleton" destroy-method="destroy"*+>
    <property name="adminManager"><ref bean="adminManager"/></property>
    <property name="threadPool"><ref bean="threadPool"/></property>
    <property name="settingsManager"><ref bean="settingsManager"/></property>
    I get the above error when trying to connect to the Primavera database. I use PPMV7 SP3 and I have installed the Integration API from EPPMV7 bundle.
    My demo's are working fine.
    Any help would be appreciated.

    Hi Marc,
    I am using a userid (is an admin)
    Using global login method and provided userid & password in integration settings.
    In the machine profiles, provided userid, password and domin.
    Not providing domain in weblogin.
    With all the above I am still getting error "Could not authenticate the specified user. %0" for HFM application
    And with the same settings I am not getting any error to connect to essbase cube.
    Any suggestions?

Maybe you are looking for