Static class error

I have a static class:
package VO
    public class ArrayValues
        private static var instance:ArrayValues = new ArrayValues();
        // dummy values will be first replaced with English versions
        // if the user clicks "Spanish" they will be replaced with that
        private var yesNoArray:Array = new Array('1','2');
        private var utilityArray:Array = new Array('1','2');
        public function ArrayValues()
            throw Error("ArrayValues is called by its instance");
        public static function getInstance():ArrayValues
            return instance;
        public function getYesNoArray():Array
            return yesNoArray;
        public function setYesNoArray(input:Array):void
            yesNoArray = input;
It is invoked here:
        import VO.ArrayValues;
        import VO.InputData;
        import VO.InputLabels;
        [Bindable]
        public var saveData:InputData = InputData.getInstance();
        [Bindable]
168       public var getArrays:ArrayValues = ArrayValues.getInstance();
It produces this error:
Error: ArrayValues is called by its instance
    at VO::ArrayValues()[C:\FSCalc\Flex\FSCalc\src\VO\ArrayValues.as:14]
    at VO::ArrayValues$cinit()
    at global$init()[C:\FSCalc\Flex\FSCalc\src\VO\ArrayValues.as:3]
    at components::InputForm()[C:\FSCalc\Flex\FSCalc\src\components\InputForm.mxml:168]
    at FSCalc/_FSCalc_InputForm1_i()
    at FSCalc/_FSCalc_Array6_c()
What am I doing wrong?
PS, is it normal to take almost 10 minutes to a) go to your discussions, b) read one response to one thread and c) get back to the normal discussion?  That seems excessive to me.

Sorry for the late reply.  I've just got back to this project after the usual "an emergency" stuff.
Yes, I'm looking to create a singleton.  I want to pass values around without having to have monster long parameter lists for the various components.
I based the Flex I have on a web page and noted it is similar to the java idea, but not identical based on that page.
I want to make sure I understand the theory behind the code.
public function ArrayValues(access:SingletonEnforcer)
     if ( access == null )
          throw Error("ArrayValues is called by its instance");
This is the constructor for the class which has the same name as the file it is in.  A parameter is passed of the type "SingletonEnforcer" and is then tested to see if it were ever invoked.  If it were, an error is created with a string which will be written to the console.
Next, a variable local to this class is created that will be of the type "ArrayValues" to hold the various arrays.  BTW, either this will have to be expanded or a parallel class created to hold the Spanish values.
static private var _instance  :  ArrayValues;
Next, the actual work horse and true "constructor" is made.  This will either allocate a new instance of the class if it doesn't already exist or instantiate it if it doesn't.  I am confused by the second class, however, when it is created the first time.  This class is included in this file?  Doesn't the file name have to match the class?

Similar Messages

  • Static class functions: PLS-00801: internal error [phd_get_defn:D_S_ED:LHS]

    Any ideas why this would generate an internal error - referring to a static class function in that class constructor's parameter signature?
    Test case (on 11.2.0.2) as follows:
    SQL> create or replace type TMyObject is object(
      2          id      integer,
      3          name    varchar2(30),
      4 
      5          static function DefaultID return integer,
      6          static function DefaultName return varchar2,
      7 
      8          constructor function TMyObject(
      9                  objID integer default TMyObject.DefaultID(), objName varchar2 default TMyObject.DefaultName()
    10          )return self as result
    11  );
    12  /
    Type created.
    SQL>
    SQL> create or replace type body TMyObject is
      2 
      3          static function DefaultID return integer is
      4          begin
      5                  return( 0 );
      6          end;
      7 
      8          static function DefaultName return varchar2 is
      9          begin
    10                  return( 'foo' );
    11          end;
    12 
    13          constructor function TMyObject(
    14                  objID integer default TMyObject.DefaultID(), objName varchar2 default TMyObject.DefaultName()
    15          )return self as result is
    16          begin
    17                  self.id := objId;
    18                  self.name := objName;
    19                  return;
    20          end;
    21 
    22  end;
    23  /
    Type body created.
    SQL>
    SQL> declare
      2          obj     TMyObject;
      3  begin
      4          obj := new TMyObject();
      5  end;
      6  /
    declare
    ERROR at line 1:
    ORA-06550: line 0, column 0:
    PLS-00801: internal error [phd_get_defn:D_S_ED:LHS]If the static class functions are removed from the constructor and applied instead inside the constructor body, it works without error. Likewise you can call the constructor with the static class functions as parameters, without an internal error resulting.
    SQL> create or replace type TMyObject is object(
      2          id      integer,
      3          name    varchar2(30),
      4 
      5          static function DefaultID return integer,
      6          static function DefaultName return varchar2,
      7 
      8          constructor function TMyObject(
      9                  objID integer default null, objName varchar2 default null
    10          )return self as result
    11  );
    12  /
    Type created.
    SQL>
    SQL> create or replace type body TMyObject is
      2 
      3          static function DefaultID return integer is
      4          begin
      5                  return( 0 );
      6          end;
      7 
      8          static function DefaultName return varchar2 is
      9          begin
    10                  return( 'foo' );
    11          end;
    12 
    13          constructor function TMyObject(
    14                  objID integer default null, objName varchar2 default null
    15          )return self as result is
    16          begin
    17                  self.id := nvl( objId, TMyObject.DefaultID() );
    18                  self.name := nvl( objName, TMyObject.DefaultName() );
    19                  return;
    20          end;
    21 
    22  end;
    23  /
    Type body created.
    SQL>
    SQL> declare
      2          obj     TMyObject;
      3  begin
      4          obj := new TMyObject();
      5  end;
      6  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> declare
      2          obj     TMyObject;
      3  begin
      4          obj := new TMyObject(
      5                          objID => TMyObject.DefaultID(),
      6                          objName => TMyObject.DefaultName()
      7                  );
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    SQL> Had a quick look on support.oracle.com and did not turn up any specific notes dealing with the use of static class functions in the parameter signature of the constructor. Known issue? Any other workaround besides the one above?

    Hi,
    there is a bug: "Bug 8470406: OBJECT INSTANCE CREATION FAILS WITH ERROR PLS-00801 IN 11GR1", it shows the behaviour in 11g but not in 10.2. It gives exactly the symptoms you also see, move it to the body and it works. But there is no solution/patch given.
    Herald ten Dam
    http://htendam.wordpress.com

  • Error LNK2028: unresolved token (0A00001F) "public: static class oracle....

    Hello,
    I am using MSVC C++ Express and Oracle XE. When I am building my C++ script I get the following errors:
    DbCheck.obj : error LNK2028: unresolved token (0A00001F) "public: static class oracle::occi::Environment * __clrcall oracle::occi::Environment::createEnvironment(enum oracle::occi::Environment::Mode,void *,void * (__clrcall*)(void *,unsigned int),void * (__clrcall*)(void *,void *,unsigned int),void (__clrcall*)(void *,void *))" (?createEnvironment@Environment@occi@oracle@@$$FSMPAV123@W4Mode@123@PAXP6MPAX1I@ZP6MPAX11I@ZP6MX11@Z@Z) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z)
    DbCheck.obj : error LNK2019: unresolved external symbol "public: static class oracle::occi::Environment * __clrcall oracle::occi::Environment::createEnvironment(enum oracle::occi::Environment::Mode,void *,void * (__clrcall*)(void *,unsigned int),void * (__clrcall*)(void *,void *,unsigned int),void (__clrcall*)(void *,void *))" (?createEnvironment@Environment@occi@oracle@@$$FSMPAV123@W4Mode@123@PAXP6MPAX1I@ZP6MPAX11I@ZP6MX11@Z@Z) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z)
    F:\Visual C++ Projects\DbCheck\Debug\DbCheck.exe : fatal error LNK1120: 2 unresolved externals
    I downloaded OCCI for Visual C++ 8 (Windows) Download (zip). but still get the error. I also linked oraocci10.lib and oraocci10d.lib but still nogo. I did it in the project property page under linker->input->additional dependencies. The configuration I choosed was:
    Configuration: Debug
    Platform: Win32
    Is there a way to determine what is missing or what is causing the error, does one of you know how to solve the problem?
    Thanks
    Rodger

    Could you try to create a CLR command line application and get that to run first ?
    This example here links and runs fine for me (it is a bit messy since I've been experimenting with my own mem leak problems, but it runs fine, you might want to change the select statement though)
    (The stdafx.h file only contains #pragma once, the TestRead class is there just to test mapping from std::string to System::String)
    #include "stdafx.h"
    #include <occi.h>
    using namespace System;
    using namespace std;
    using namespace oracle::occi;
    public ref class TestRead
    public:
         System::String^ GetStr(int index);
    internal:
         oracle::occi::ResultSet* m_resultSet;
    System::String^ TestRead::GetStr(int index)
         try
              return gcnew System::String(m_resultSet->getString(index).c_str());
         catch (const oracle::occi::SQLException& ex)
              throw gcnew System::Exception(gcnew System::String(ex.getMessage().c_str()));
         return "";
    int main(array<System::String ^> ^args)
    try
         oracle::occi::Environment *env = oracle::occi::Environment::createEnvironment((oracle::occi::Environment::Mode)(oracle::occi::Environment::OBJECT | oracle::occi::Environment::THREADED_MUTEXED));
    Connection *conn = env->createConnection("test","test","");
    try
    oracle::occi::Statement *stmt = conn->createStatement("Select site_addr From parcel");
    oracle::occi::ResultSet *rs = stmt->executeQuery();
         TestRead^ testread = gcnew TestRead();
         testread->m_resultSet = rs;
    //int MktId;
    string MktName;
    int rowno = 1;
    while (rs->next())
              System::String^ name = testread->GetStr(1);
    rowno++;
         // if (rowno > 100)
         //     break;
    stmt->closeResultSet(rs);
    conn->terminateStatement(stmt);
    catch (SQLException &ex)
    env->terminateConnection(conn);
    oracle::occi::Environment::terminateEnvironment(env);
    throw;//re-throw
    env->terminateConnection(conn);
    oracle::occi::Environment::terminateEnvironment(env);
    catch (SQLException &ex)
    Console::WriteLine(L"Hello World");
    return 0;
    }

  • Non static variable error

    There may be more errors in here besides the static variable error. I made the methods static for the method call in my constructor Product(name, price). The purpose of this Class is to the the name and price of a product from user input, subtract 5.00 from the price, and return the new price. Please help!!!
    public class Product
    public Product(String name, double price)
    String product;
    price = Product.getPrice(price);
    Double.toString(price);
    //this.product = product;
    product = Product.getName(name) + Product.getPrice(price);
    public static String getName(String name)
    System.out.println("What is their name?: ");
    name = in.nextLine(); // I GET A NONSTATIC VARIABLE ERROR FOR variable "in" HERE.
    return name;
    public static double getPrice(double price)
    this.price = price;
    System.out.println("What is the price?: ");
    price = in.nextDouble();
    return price;
    public double reducePrice()
    price = price - 5.00;
    return price;
    public String getProduct()
    product = new Product(name, price);
    return product;
    Scanner in = new Scanner(System.in);
    public static String name;
    //public double price;
    }

    you not define the class member properly.
    the class member is define before the constructor as
    public class Product {
         static Scanner in = new Scanner(System.in);
         String product;
         double price;
         public static String name;
         public Product(String name, double price) {
              price = Product.getPrice(price);
              Double.toString(price);
              // this.product = product;
              product = Product.getName(name) + Product.getPrice(price);
    }

  • Implementing Custom Event - non-static referencing in static context error

    Hi,
    I'm implementing a custom event, and I have problems adding my custom listeners to objects. I can't compile because I'm referencing a non-static method (my custom addListener method ) from a static context (a JFrame which contains static main).
    However, the same error occurs even if I try to add the custom listener to another class without the main function.
    Q1. Is the way I'm adding the listener wrong? Is there a way to resolve the non-static referencing error?
    Q2. From the examples online, I don't see people adding the Class name in front of addListener.
    Refering to the code below, if I remove "Data." in front of addDataUpdatelistener, I get the error:
    cannot resolve symbol method addDataUpdateListener (<anonymous DataUpdateListener>)
    I'm wondering if this is where the error is coming from.
    Below is a simplified version of my code. Thanks in advance!
    Cindy
    //dividers indicate contents are in separate source files
    //DataUpdateEvent Class
    public class DataUpdateEvent extends java.util.EventObject
         public DataUpdateEvent(Object eventSource)
              super(eventSource);
    //DataUpdateListener Interface
    public interface DataUpdateListener extends java.util.EventListener
      public void dataUpdateOccured(DataUpdateEvent event);
    //Data Class: contains data which is updated periodically. Needs to notify Display frame.
    class Data
    //do something to data
    //fire an event to notify listeners data has changed
    fireEvent(new DataUpdateEvent(this));
      private void fireEvent(DataUpdateEvent event)
           // Make a copy of the list and use this list to fire events.
           // This way listeners can be added and removed to and from
           // the original list in response to this event.
           Vector list;
           synchronized(this)
                list = (Vector)listeners.clone();
           for (int i=0; i < list.size(); i++)
                // Get the next listener and cast the object to right listener type.
               DataUpdateListener listener = (DataUpdateListener) list.elementAt(i);
               // Make a call to the method implemented by the listeners
                  // and defined in the listener interface object.
                  listener.dataUpdateOccured(event);
               System.out.println("event fired");
    public synchronized void addDataUpdateListener(DataUpdateListener listener)
         listeners.addElement(listener);
      public synchronized void removeDataUpdateListener(DataUpdateListener listener)
         listeners.removeElement(listener);
    //Display Class: creates a JFrame to display data
    public class Display extends javax.swing.JFrame
         public static void main(String args[])
              //display frame
              new Display().show();
         public Display()
         //ERROR OCCURS HERE:
         // Non-static method addDataUpdateListener (DataUpdateListener) cannot be referenced from a static context
         Data.addDataUpdateListener(new DataUpdateListener()
             public void dataUpdateOccured(DataUpdateEvent e)
                 System.out.println("Event Received!");
    //-----------------------------------------------------------

    Calling
        Data.someMethodName()is referencing a method in the Data class whose signature includes the 'static' modifier and
    might look something like this:
    class Data
        static void someMethodName() {}What you want is to add the listener to an instance of the Data class. It's just like adding
    an ActionListener to a JButton:
        JButton.addActionListener(new ActionListener()    // won't work
        JButton button = new JButton("button");           // instance of JButton
        button.addActionListener(new ActionListener()     // okay
    import java.awt.*;
    import java.awt.event.*;
    import java.util.Vector;
    import javax.swing.*;
    public class EventTest extends JFrame
        Data data;
        JLabel label;
        public EventTest()
            label = getLabel();
            data = new Data();
            // add listener to instance ('data') of Data
            data.addDataUpdateListener(new DataUpdateListener()
                public void dataUpdateOccured(DataUpdateEvent e)
                    System.out.println("Event Received!");
                    label.setText("count = " + e.getValue());
            getContentPane().add(label, "South");
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            setSize(300,200);
            setLocation(200,200);
            setVisible(true);
        private JLabel getLabel()
            label = new JLabel("  ", JLabel.CENTER);
            Dimension d = label.getPreferredSize();
            d.height = 25;
            label.setPreferredSize(d);
            return label;
        public static void main(String[] args)
            new EventTest();
    * DataUpdateEvent Class
    class DataUpdateEvent extends java.util.EventObject
        int value;
        public DataUpdateEvent(Object eventSource, int value)
            super(eventSource);
            this.value = value;
        public int getValue()
            return value;
    * DataUpdateListener Interface
    interface DataUpdateListener extends java.util.EventListener
        public void dataUpdateOccured(DataUpdateEvent event);
    * Data Class: contains data which is updated periodically.
    * Needs to notify Display frame.
    class Data
        Vector listeners;
        int count;
        public Data()
            listeners = new Vector();
            count = 0;
            new Thread(runner).start();
        private void increaseCount()
            count++;
            fireEvent(new DataUpdateEvent(this, count));
        private void fireEvent(DataUpdateEvent event)
            // Make a copy of the list and use this list to fire events.
            // This way listeners can be added and removed to and from
            // the original list in response to this event.
            Vector list;
            synchronized(this)
                list = (Vector)listeners.clone();
            for (int i=0; i < list.size(); i++)
                // Get the next listener and cast the object to right listener type.
                DataUpdateListener listener = (DataUpdateListener) list.elementAt(i);
                // Make a call to the method implemented by the listeners
                // and defined in the listener interface object.
                listener.dataUpdateOccured(event);
            System.out.println("event fired");
        public synchronized void addDataUpdateListener(DataUpdateListener listener)
            listeners.addElement(listener);
        public synchronized void removeDataUpdateListener(DataUpdateListener listener)
            listeners.removeElement(listener);
        private Runnable runner = new Runnable()
            public void run()
                boolean runit = true;
                while(runit)
                    increaseCount();
                    try
                        Thread.sleep(1000);
                    catch(InterruptedException ie)
                        System.err.println("interrupt: " + ie.getMessage());
                    if(count > 100)
                        runit = false;
    }

  • Static class variable

    Folks:
    I am little confused by static class variables in Java. Since Java doesn't have global varaibles it uses static variables instead. Please take a look at the following code and please tell me what goes wrong.
    /********** CONTENT OF Stack.java ***********/
    import java.util.Stack;
    public class StackClass
    {   static  Stack stack = new Stack (); }
    /********** CONTENT OF Test1 .java ***********/
    public class Test1
    public static void main( String[] args )
    StackClass.stack.push("Hello World");
    /********** CONTENT OF Test2.java ***********/
    public class Test2
    public static void main( String[] args )
    System.out.println( "Top on stack is " + StackClass.stack.peek() );
    I execute the above programs in the sequence of StackClass.java, Test1.java and Test2.java. I think in Test1.java after I push one element to the stack it should still be in the stack in Test2.java But I got :
    java.util.EmptyStackException
         at java.util.Stack.peek(Unknown Source)
         at Test2.main(Test2.java:16)
    Exception in thread "main"
    Can anybody give me a hint?
    Thanks a lot !

    After you run StackClass, the JVM (java.exe) ends and all the classes are unloaded including StackClass
    When you run Test1, StackClass is loaded, an item is pushed on the stack, and then the JVM exits and all classes are unloaded including StackClass
    When you run Test2, StackClass is loaded, and you get an error because the StackClass which was just loaded has no items in it.

  • Lifetime of static classes in WebDynpro

    Hi,
    I have a question regarding static java classes in WebDynpro: Does anybody know details about their lifetime. I was searching for this information but I didn't find info.
    The background of this question is, that I would like to store configuration data (customizing) from the R/3 in a static class of my WebDynpro application, in order to minimize DB requests. Exists a static class for the whole WebDynpro session or is it destroyed after every user interaction?
    Thanks in advance,
    Martin

    Hi
    If  I have understood you
             You  want to create a static class,  you are expecting the values will remain same for the lifetime of the
    webdynpro app.
    In order to understand the use of the static keyword in class declaration, we need to understand the class
    declaration itself. You can declare two kinds of classes: top-level classes and inner classes.
    Top-level classes
    You declare a top-level class at the top level as a member of a package. Each top-level class corresponds to
    its own java file sporting the same name as the class name.
    A top-level class is by definition already top-level, so there is no point in declaring it static; it is an error to do
    so. The compiler will detect and report this error.
    you cant write a code like
    public static class hello {
    it gives an error like
    Illegal modifier for the class hello; only public, abstract & final are permitted
    Regards
    Abhijith YS

  • Non-static method error message

    why this error message? i'm new to Java.
    Non-static method compare(java.lang.object,java.lang.Object) cannot be referenced from a static context at line 54.
    Any assistance would be greatly appreciated. Thanks.
    Calling Method;
    private static void selectionSort(Object[] objectArray)
    int min, temp;
    for (int index = 0; index < objectArray.length-1; index++)
    min = index;
    int alen = objectArray.length;
    for (int scan = index+1; scan < alen; scan++)
    (Line 54) NameComparator.compare(objectArray[scan],objectArray[min]);
    Invoked Class/Method:
    import java.util.Comparator;
    public class NameComparator implements Comparator {
    private String object, object1, firstCompare, secondCompare;
    // Constructors
    public NameComparator()
    firstCompare = object;
    secondCompare = object1;
    // Compare method
    public int compare(Object object, Object object1)
    int result = firstCompare.compareTo(secondCompare);
    return result;
    }

    That message occurs when you attempt to call a regular class method from a static class method, which usually means that you've called a regular method from main(). Remember this is main:
    public static void main( String[] args ) { . . . }The static keyword means that main() is part of the class, but not part of objects created from that class. The error message is really saying:
    // You're trying to use a method that needs an object of this class type,
    // but you don't have an object of this class type.I get this message often enough. It just means that I forgot to create an object, or that I forgot to use it when I called the method.
    class SomeThing {
      public static void main( String[] args {
        doWhatever(); // wrong - requires a SomeThing object
        SomeThing st = new SomeThing(); // got a SomeThing now
        doWhatever(); // still wrong - only works for an object
        st.doWhatever(); // finally right!
      } // end main()
      SomeThing() { . . . } // constructor for SomeThings
      doWhatever() { . . . } // method that a SomeThing can perform
    } // end of class SomeThing

  • .class error

    Hi,
    I am trying to make a simple code where a main program calls a method in a class so that the total sum of all elements of an array is calculated. Here is my code:
    public class playingwithArrays
            static void sumArray(int [] arr){
                int sum = 0;
                    for(int i = 0; i<arr.length; i++){
                        sum+= arr;
    System.out.println ("Total sum of array is" + sum);
    This is the class where there is the method i want to access
    The class below is the main class:public class Start
    public static void main (STring[] args){
    int [] arr = new int [10];
    for (int i; i<arr.length; i++){
    arr[i] = (i+1);
    playingwithArrays summation = new playingwithArrays ();
    summation.sumArray(int arr[]);
    Where there is bold the compiler is giving me a .class error. Please can you help me as I am a beginner and I am trying to learn java!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    It's a good idea to follow standard conventions about nAmEs. PlayingWithArrays, not playingwithArrays.
    You define sumArray() as a static method. That means that it will not be associated with a particular instance of the PlayingWithArrays class. And so you can access it without having to create a new instance of the class.
    It's not actually wrong to say summation.sumArray(...), it's just that it looks odd. It would better be PlayingWithArrays.sumArray(...).
    The actual error is what you are passing as the argument. This method expects an array of int and that's what you should pass it. You don't need the int and [] business that goes into the declaration of a method, just use the variable.
    PlayingWithArrays.sumArray(arr);This will use a static method of the PlayingWithArrays class to print out the sum of the array elements.

  • How to create static class in Netbeans ?

    I want to create a static class in netbeans.
    But it gives error like : static modifier not allowed here. as far as java prog concern it is syntactically correct.
    for eg.
    public static class Emp
    -------body & methods
    it looks correct syntactically, but gives error in netbeans, static modifier not allowed here. Why ? How to create static class in netbeans ?

    DrClap wrote:
    I have occasionally seen the name "static class" used to denote a class whose members are all static.I think this is quite common.
    But taking the name literally and trying to declare a class "static" is a little naive."naive" or being used to doing that in C#.

  • Inner static class implementing interface

    Hello,
    I have a sample program to test on reflections. here the code goes
    import java.lang.reflect.*;
    import java.awt.*;
    import java.lang.*;
    import java.io.*;
    public class SampleName {
       public static void main(String[] args) {
          NewClass b = new NewClass();
           System.out.println("Calling printModifiers");
           printModifiers(b);
             System.out.println("Calling printInterfaces");
           printInterfaces(b);
       static void printModifiers(Object obj){
              Class cl = obj.getClass();
              int mod = cl.getModifiers();
              if(Modifier.isPublic(mod ))
                   System.out.println("Public");
              if(Modifier.isPrivate(mod ))
                   System.out.println("Private");
              if(Modifier.isFinal(mod ))
                   System.out.println("Final");
              if(Modifier.isStatic(mod ))
                   System.out.println("Static");
              if(Modifier.isAbstract(mod ))
                   System.out.println("Abstract");
       static void printInterfaces(Object o) {
              Class c = o.getClass();
              String str = c.getName();
              System.out.println("name  " +str);
              Class[]  theInterfaces= c.getInterfaces();
              if(theInterfaces.length ==0)
                   System.out.println("no interfaces here ");
              else
                   for(int counter = 0; counter<theInterfaces.length;counter++)
                             String interfaceName = theInterfaces[counter].getName();
                             System.out.println("Interface Name :- " +interfaceName);
    static class NewClass implements newInterface {
    }i have an interface in t same folder as
    public interface newInterface
    }i get an error as below while compiling this java code
    SampleName.java:54: cannot resolve symbol
    symbol  : class newInterface
    location: class SampleName.NewClass
    static class NewClass implements newInterface {
                                      ^
    1 errorplease explain me what is the fault i am making and how can it be resolved.
    tnx

    java -cp .;<any other directories or jars> YourClassNameYou get a NoClassDefFoundError message because the JVM (Java Virtual Machine) can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.
    The Gateway to Classpath Nirvana
    Setting the class path (Windows)
    How Classes are Found

  • Generic Class Errors continue

    Hi have had "generic class" errors with my printers on my MacPro for over two years now. First with a Samsung and now with a Brother printer. I have the latest drivers for the Mac, I have the latest Leopard and I still get these really annoying errors that require restarting everything. I had the problems with Tiger too.
    Is there any way to avoid this kind of mess?
    Any help appreciated.

    kittireddy wrote:
    What is "Generic class" in Java? and what's use of that?It's just added to confuse new programmers.
    Give me an idea with an exampleNo problem:
    public class GenericsExample {
        public static void main(String[] args) {
            new X<String>(new X<String>("Y"));
    class X<Y> {
        Y x;
        X(Y y) { x = y; }
        X(X<Y> y) { System.out.println("y.x = "+y.x); }
    }

  • Purpose of static classes

    What is the purpose of making a class static?
    public static class December {
    }The only reason I can see is to access inner-classes without instantiating the outer-class? Are there any other?

    see these
    http://forum.java.sun.com/thread.jsp?forum=31&thread=277820
    http://forum.java.sun.com/thread.jsp?forum=31&thread=305260

  • Plug-in load class error while running portalapp.xml file in NWDS7.0

    hi,
    im facing a problem in NWDS7.0 while running portalapp.xml file im getting error realted some plug-in load class error.
    Even 3 times i have re-installed but still getting same error.
    Please help me how to over come this. This is error im getting :
    Please open this link with Firefox so that you can able to see error.
    http://www.imageurlhost.com/images/jri5lj7lpftu23ejyye0_Error.jpg
    Regards,
    prasad.

    Dear Prasad
    Please right click on portalapp.xml > open with > check all the available editors.
    Also restore default edition in NWDS. Go to windows > preference > Workbench OR Web editors > click on restore default and Apply and then Ok.
    then close the NWDS and open it.
    Hope it will helps
    Best Regards
    Arun Jaiswal

  • Creation of a static class with private methods

    I'm new to java programming and am working on a project where I need to have a static class that does a postage calculation that must contain 2 private methods, one for first class and one for priority mail. I can't seem to figure out how to get the weight into the class to do the calculations or how to call the two private methods so that when one of my other classes calls on this class, it retrieves the correct postage. I've got all my other classes working correct and retrieving the information required. I need to use the weight from another class and return a "double". Help!!!
    Here's my code:
    * <p>Title: Order Control </p>
    * <p>Description: Order Control Calculator using methods and classes</p>
    * <p>Copyright: Copyright (c) 2002</p>
    * <p>Company: Info 250, sec 001, T/TH 0930</p>
    * @author Peggy Blake
    * @version 1.0, 10/29/02
    import javax.swing.*;
    public class ShippingCalculator
    static double firstClass, priorityMail;
    //how do I get my weight from another class into this method to use??? not sure I understand how it works.
    public static double ShippingCalculator(double weight)
    String responseFirstClass;
    double quantity, shippingCost;
    double totalFirstClass, firstClass, priorityMail, totalShipping;
    double priorityMail1 = 3.50d;//prioritymail fee up to 1 pound
    double priorityMail2 = 3.95d;//prioritymail fee up to 2 pounds
    double priorityMail3 = 5.20d;//prioritymail fee up to 3 pounds
    double priorityMail4 = 6.45d;//prioritymail fee up to 4 pounds
    double priorityMail5 = 7.70d;//prioritymail fee up to 5 pounds
    quantity = 0d;//ititialization of quantity
    // weight = 0d;//initialization of weight
    // shippingCost = 0d;
    //calculation of the number of items ordered..each item weights .75 ounces
    quantity = (weight/.75);
    if (quantity <= 30d)
    //add 1 ounce to quantities that weigh less than 30 ounces
    weight = (weight + 1);
    else
    //add 2 ounces to quantities that weigh more than 30 ounces
    weight = (weight + 2);
    if (weight > 80d)
    //message to orderclerk ..order over 5 lbs, cannot process
    JOptionPane.showMessageDialog(null, "Order exceeded 5 lbs, cannot process");
    //exit system, do not process anything else
    System.exit (0);
    else
    if (weight < 14d)
    //send message to customer: ship firstclass or priority, y or n
    responseFirstClass = JOptionPane.showInputDialog(null, "Ship first class? y or n?");
    if (responseFirstClass.equals("y"))
    //compute FirstClass shipping cost
    totalFirstClass = ((weight - 1) * .23d) + .34d;
    firstClass = totalFirstClass;
    else
    //compute PriorityMail cost for orders less than 14 ounces
    priorityMail = (priorityMail1);
    else
    if (weight <=16d)
    //compute totalshipping for orders up to 16 ounces
    priorityMail = (priorityMail1);
    else
    if (weight <=32d)
    //compute totalshipping for orders up to 32 ounces
    priorityMail = (priorityMail2);
    else
    if (weight <=48d)
    //compute totalshipping for orders up to 48 ounces
    priorityMail = (priorityMail3);
    else
    if (weight <= 64d)
    //compute totalshipping for orders up to 64 ounces
    priorityMail = (priorityMail4);
    else
    //compute totalshipping for orders up to 80 ounces
    priorityMail = (priorityMail5);
    priorityMail = 0d;
    firstClass = 0d;
    firstClassMail ();
    priorityMailCost ();
    //I think this is where I should be pulling the two methods below into my code, but can't figure out how to do it.
    shippingCost = priorityMail + firstClass;
    return (shippingCost);
    }//end method calculate shipping
    private static double firstClassMail()//method to get first class ship cost
    return (firstClass);
    }//end method firstclass shipping
    private static double priorityMailCost()//method to get priority mail cost
    return (priorityMail);
    }//end method priorityMail
    }//end class shipping calculator

    public class A {
    public String getXXX () {
    public class B {
    A a = new A();
    public void init () {
    a.getXXX();
    }

Maybe you are looking for

  • Pen drive + mov = ??

    exported a movie from final cut express up at school and put It on my flash drive. I got home and tried to copy it to my mac and it said insuficient privelages. Then ejects the drive. I try using vlc, fce, and fcp but to up avail. I bet that if I try

  • Zoom in/out for CLDC

    Hi all, Can you help with a zoom in/out function? I've seen several methods with area filtering for Java SE but they don't seem to be the best for mobile devices. In the oder side i have a function with two joined loops in both image-dimension which

  • I cannot download any CC trial.Can anyone please help me?

    Its been going on for a few weeks now. Whenever I try to download any Adobe CC product trial ,it freezes at 0% and after about 30 minutes ,it gives me a downloading error and gives me the retry option. Please help me anyone..

  • How to program smart cards

    Can help me where i can get infomation about smart card programming how to program on 4428 but mainly on MCU how files are made and how many files can i make guide me on this where can i get Help or get to read about them I am trainee at www.thechipt

  • How can we use antscripts for Webservices in SOA BPEL.

    Hi all, i need to deploy all my BPEL, ESB and webservices in Dev/Test. i used antscripts to deploy those services. as of now i am able to deploy BPEL and ESB services successfully.now i need to invoke 4 webservices in my BPEL Process throw partnerlin