How do I access data from another class?

I have a class RailNetwork which extends Datastore. DataStore contains a vector filelines which I need to access from RailNetwork. How do I do this? What do I put infront of filelines.get(i); ?
public abstract class DataStore
{    Vector<String> fileLines = new Vector<String>(); }
public class RailNetwork extends DataStore
{    ...main(){ .......filelines.get(i);....... }
}

This is the code from RailNetwork class:
public static void main(String[] args) {
          String templine;
          int i = 0;
          int vectorlength = super.filelines.size();
          for( i = 0 ; i < vectorlength ; i++ )
               templine = (String) super.filelines.get(i);
               setStations(templine);  }The errors (for both lines, only 1 shown):
RailNetwork.java:49: non-static variable super cannot be referenced from a static context
                        templine = (String) super.filelines.get(i);
                                            ^
RailNetwork.java:49: cannot find symbol
symbol  : variable filelines
location: class DataStore
                        templine = (String) super.filelines.get(i);
                                                 ^

Similar Messages

  • How can i get data from another database SQL Server use database link from

    I have a database link from Oracle connect to SQL Server database with user cdit connect default database NorthWind.How can I get data from another database(this database in this SQL Server use this database link)?

    hi,
    u should see following documentation:
    Oracle9i Heterogeneous Connectivity Administrator's Guide
    Release 1 (9.0.1)
    Part Number A88789_01
    in it u just go to chapter no. 4 (using the gateway),,u'll find ur answer there.
    regards
    umar

  • .How to instantiate the innerclass from another class with coded eg.

    How to instantiate the innerclass from another class(both for static & non static) please give me an eg with coding.

    It's just a preference, but I like writing factory methods:
    public class Outer {
        public class Inner {}
        public static class StaticInner {}
        public Inner innerInstance() {
            return new Inner();
        public static StaticInner staticInnerInstance() {
            return new StaticInner();
        public static void main(String[] args) {
            Outer.StaticInner si = Outer.staticInnerInstance();
            Outer outer = new Outer();
            Outer.Inner i = outer.innerInstance();
    }Often, for me, the inner class implements an interface, and the factory method
    lets you hide the implementation class:
    public class Outer {
        private class Inner implements Runnable {
            public void run() {}
        public Runnable runnerInstance() {
            return new Inner();
        public static void main(String[] args) {
            Outer outer = new Outer();
            Runnable r = outer.runnerInstance();
    }

  • How do I access  data from one user account to another?

    I want to access data from a different user account. How do I make all the files available?

    I have another post here in the forum that explains in detail about the rez problem. It was read by a lot of people with no responses. 1 thing that might be important is that I was using a Wacom drawing tablet when this problem started. I removed the Wacom software and no help.
    My Apple 23" Cinema display has very large icons but the display prefs says it is at 1920 x 1200. It's not just a low screen rez but the dock and all icons will scroll on the screen when I move the mouse.
    The resolution will not change to anything else. The rez is fine on other user names.
    I have booted from the Apple DVD and run disk repair, repaired disk permissions. Booted and run Tech Tool.
    Booted from the Disk Warrior cd and ran that.
    I have zapped the PRAM. I have plugged the display into the other port on the video card.
    When I change to the problem user name it is fine for about 1 second and then changes to the "problem". I have never seen this before and I have been using a Mac since 1990.
    It's a G-5. Dual 2.0 ghz. 2.5 gb ram. OS 10.5.8. Apple keyboard. Logitech mouse and
    Thanks.

  • How to call a method from another class

    I have a problem were i have to call a method from another class. What is the command line that i have to use. Thanks.

    Here's one I wipped up in 10 minutes... Cool!
    package forums;
    import javax.swing.JFrame;
    import javax.swing.JTextArea;
    import krc.utilz.io.Filez;
    import java.io.FileNotFoundException;
    class FileDisplayer extends JFrame
      private static final long serialVersionUID = 0L;
      FileDisplayer(String filename) {
        super(filename);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setSize(600, 800);
        JTextArea text = new JTextArea();
        try {
          text.setText(Filez.read(filename));
        } catch (FileNotFoundException e) {
          text.setText(e.toString());
        this.add(text);
      public static void main(String args[]) {
        final String filename = (args.length>0 ? args[0] : "C:/Java/home/src/forums/FileDisplayer.java");
        try {
          java.awt.EventQueue.invokeLater(
            new Runnable() {
              public void run() {
                new FileDisplayer(filename).setVisible(true);
        } catch (Exception e) {
          e.printStackTrace();
    Filez.read
       * reads the given file into one big string
       * @param String filename - the name of the file to read
       * @return the contents filename
      public static String read(String filename) throws FileNotFoundException {
        return Filez.read(new FileReader(filename));
       * Reads the contents of the given reader into one big string, and closes the reader.
       * @param java.io.Reader reader - a subclass of Reader to read from.
       * @return the whole contents of the given reader.
      public static String read(Reader in) {
        try {
          StringBuffer out = new StringBuffer();
          try {
            char[] bfr = new char[BFRSIZE];
            int n = 0;
            while( (n=in.read(bfr,0,BFRSIZE)) > 0 ) {
              out.append(bfr,0,n);
          } finally {
            if(in!=null)in.close();
          return out.toString();
        } catch (IOException e) {
          throw new RuntimeIOException(e.getMessage(), e);
      }Edited by: corlettk on Dec 16, 2007 1:01 PM - dang [code [/tags][                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Accessing data from another computer - a strain on my computer?

    My wife has an IBM Thinkpad laptop that is not connected to the internet. My computer is connected to the internet and sometimes she accesses her e-mail on it by clicking on a bookmark that I set up for her that links directly to her e-mail at work. Her entire work e-mail system (microsoft pc based) appears on my computer and she logs in. All of her e-mails (thousands) are on my computer including huge documents and such. I suspect that doing this may be causing my computer to freak out a bit.
    I only have 1GB of RAM. I once typed in the name of the bookmark "Ann's e-mail" into "spotlight" and it appears as though all of her work e-mails seem reside on my hard drive. One time she was checking her e-mail and a kernel panic happened. She's stopped checking her e-mail on my computer and the kernel panics no longer happen. Perhaps this is a coincidence but in general, do all her e-mails reside on my hardrive all the time or only when she clicks on the bookmark and logs in. Lately she doesn't even have to log in. All e-mail appears when she clicks on the bookmark. In the past it always asked for her password first. (I find it strange that it no longer asks for her password) ) She's going to be getting her own internet connection soon but does anyone know if bookmark that links to a ton of data on another computer uses up RAM or CPU on my computer?? Should I delete the bookmark?

    It sounds like you should be doing Internet Sharing on yours, is that not the case?
    Thank you for your reply, BDAqua. I haven't but doing internet sharing.
    Upgrade your RAM to 2 or 2.5 GB.
    I was told at the Apple store than the model I have will not allow any additional upgrades. When I bought the unit it had 512MB and I had 1GB of memory put in the only other remaining memory slot. So I actually have 1.5 GB RAM. AT some point I'm be getting a new computer in order to get 4GB RAM but can't afford it right now.
    What interface do you connect with, what interface does she connect wirh, and what is available on both?
    Sorry, don't understand this question. Do you mean how do I get the internet? I have Road Runner from Time Warner Cable. My wife's home laptop isn't connected to anything. She wants to get an Air Card so she can access the internet when she travels.

  • Accessing variable from another class

    Say I want to access String ABC from class XYZ from my main class. I have already created the object for the class I just don't know the syntax for accessing the variable.
    This is just an example. I figured this is just a problem of finding the right syntax so I didn't bother creating a compiling code.
    public class test{
    public static void main(String[]args){
         XYZ xyz = new XYZ ();
         String a = abc.XYZ(); // this is where i want to directly access the variable abc. i know this isn't correct and it's what im trying to find out how to do.
    public class XYZ{
         String abc = "hi";
    }Edited by: aznprdgy on Nov 3, 2009 2:13 PM

    No, that isn't possible.
    abc is said to be a local variable. And it's only useable within method().
    It's part of the job of the class Xyz to control the access to its state. As an example:
    public class Test {
        public static void main(String[] args) {
            Xyz xyz = new Xyz()
            String a = xyz.getSpecialValue();
    public class Xyz {
        private String a;
        public String getSpecialValue() {
            return a;
        public void method() {
            a = "hi";
    }Note that a won't be reference to the string "hi" until after method() has been called.

  • Possible? access data from another effects plugin

    right this sounds complicated so I'm gonna ask if its even possible before i start trying to build this. Picture this scenario.
    Main comp has layer "A" which is a sub-composition, B. The layer A has my filter on it.
    In comp B, we have a layer "C" with my filter on it (or another one of my filters on it)
    When rendering the main comp, can the filter on A access information held by the filter "C" in comp "B"?
    seems weird but what I'm after here is reusability. The filter on C will contain some information that A needs to render correctly. By placing the information in the nested comp "B", B can be reused anywhere in the project. Alternatively if I just did everything inside filter A, this meta information cannot be propagated across all uses of comp B across the project.
    phew. confused? I know I am.

    That's some scary stuff, but YES, plug-ins can access each others' data. See the Sweetie sample for how a plug-in can expose a function suite that other plug-ins can call. You'll also need a bunch of AEGP_EffectSuite calls to find other plug-in instances, and get at their params.
    I strongly recommend against doing this, however; think of the user!

  • How update xellerate form data from Action class

    Hi Experts,
    i did some customization in Action class.
    Now from this Action class i want toupdate xellerate from data
    Using digital signature i got the status of one of the attribute of xellerate from
    ie
    userIntf = (tcUserOperationsIntf)utilityFactory.getUtility("Thor.API.Operations.tcUserOperationsIntf");
    tcResultSet tRs = userIntf.findAllUsers(userMap);
    if(tRs.getRowCount() > 0)
    userLoginStatus= tRs.getBooleanValue("USR_UDF_IS_FIRST_LOGON");
    now i want update this attribute, ie ifuserLoginStatus is true, i want to update as false
    help me how to achive this..
    thanks

    How to update userdata using OIM API
    Thanks

  • How to Pass the data from the class to the BSP application(ie. .html page)

    hi
    i had created one .html page. This page is getting opened after clicking on one of the buttton of the toolbar(say Bank Data).
    Now the problem is , to show the data of the bank which user had entered in the PCUI application on the .html page.
    Please help me to solve the problem

    Thanks for your answer, I tried the solution 2, I create "Submit" button, and ser the mapping scope to  be "All data rows", it only works when I select at least one row, otherwise the data would not be passed.
    Another question is I have serveral imported table parameter, for each table I have one "submit" event, I want these tables to be submitted at the same time, but if I click the submit button in one table toolbar, I can only submit the table data which has a submit button clicked, for other tables, the data is not passed, how can I achieve it?
    Thanks.

  • How to assign a method from another class to dropDown processValueChange

    Hi
    Thank you for reading my post.
    in normal way we use same backing bean for methods of components and our pages.
    now i want to set the method that called after a dropDown value changed to another claas method.
    for example if my page name is
    messages.jsp and its backing bean is messages.java i want to set processValueChange of a dropDown box to class2.methodForDropDown...
    can some one please help me

    One approach will be to make your class a ivar of PageBean or SessionBean. That way you instantiate your class either in PageBean/SessionBean and PageBean or SessionBean as a parameter depending on the scope requirements of your class.
    Other approach which is eaiser would be to use the JSF API
    ValueBinding vb = FacesContext.getCurrentInstance().getApplication().
    createValueBinding("#{SessionBean1});
    SessionBean1 bean1 = vb.getValue(FacesContext.getCurrentInstance());
    The above code can be used anywhere within a JSF application to retrieve an object from any scope as long as the request has passed through the FacesServlet.
    No, you can't pass parameters to processValueChange.
    Hope this helps
    -Jayashri

  • How can I access data from accidentally deleted user?

    I was given a MacBook Pro by a family member. I set myself as the Administrator, but could not get rid of the previous owner's name on the Home folder.
    In my attempts I accidentally deleted something that made the entire computer unaccessable. I can boot up, however, all the work and applications I installed are unaccessable. I can't even open Preferences.
    I used TechTool Pro to start up and explore the drive, and found that the previous owner's name was on a folder with a red-circled minus sign. The data (considerable) was inside, but I can't access it.
    Is there any way I can get access to that data? I slaved the laptop to my iMac and transferred the folder (with 32 gb of data).
    When I tried to open it I got the message: "The folder "sandy....." can't be opend because you don't have permission to see its contents." I used Get Info on the folder and changed Sharing and Permissions to Read and Write, but still no access.
    What can I do, if anything to gain access to that folder?

    http://docs.info.apple.com/article.html?path=Mac/10.7/en/mchlp2968.html

  • How to insert subtype data from another table in  a object table ?

    Hi all
    I have been looking at the differences answers there are about insert data form a subtype in a object table of a supertype ,but have not found a solution yet.
    I hope you can help me.
    I my code Action_Logs is the object table and CloseStore_Logs_t is a subtype of Action_Logs_t
    My code is
    insert into Action_Logs(CloseStore_Logs_t (action_logs_id , physicalstores.physicalstores_id , brandedstores.BRANDEDSTORES_ID ,physicalstores.COMPANIES_ID ,brandedstores.CREATED_BY ,
    brandedstores.CREATED_DATE , brandedstores.DELETED ,brandedstores.CLOSED_DATE as brandedstore_closedate,
    physicalstores.CLOSED_DATE as physicalstore_closedate)
    select CloseStore_Logs_t((null as action_logs_id , physicalstores.physicalstores_id , brandedstores.BRANDEDSTORES_ID ,physicalstores.COMPANIES_ID ,brandedstores.CREATED_BY ,
    brandedstores.CREATED_DATE , brandedstores.DELETED ,brandedstores.CLOSED_DATE as brandedstore_closedate,
    physicalstores.CLOSED_DATE as physicalstore_closedate)
    from physicalstores , brandedstores ,companies
    where physicalstores.physicalstores_id = brandedStores.PHYSICALSTORES_ID and
    physicalstores.COMPANIES_ID = companies.COMPANIES_ID and
    brandedstores.closed_date is not null
    oracle gives a ora _917 fault about a missing comma , but I can not se what is wrong.
    I will be glad, if you can give me an example with a right syntax where a subtype is selected from other/s tables an inserted in table of its supertype.
    kinds regards
    steen ostersen

    Hi
    I see two problems with your statement:
    1) The utilization of the values clause is not permitted along with a subquery.
    2) The AS are not allowed.
    So, something like that should work:
    insert into Action_Logs
    select CloseStore_Logs_t(null,
    physicalstores.physicalstores_id,
    brandedstores.BRANDEDSTORES_ID,
    physicalstores.COMPANIES_ID,
    brandedstores.CREATED_BY,
    brandedstores.CREATED_DATE,
    brandedstores.DELETED,
    brandedstores.CLOSED_DATE,
    physicalstores.CLOSED_DATE)
    from physicalstores , brandedstores ,companies
    where physicalstores.physicalstores_id = brandedStores.PHYSICALSTORES_ID and
    physicalstores.COMPANIES_ID = companies.COMPANIES_ID and
    brandedstores.closed_date is not null
    HTH
    Chris

  • How to call a variable from another class?

    Greetings
    I�m designing a program that is called Senior.java, and I want to design it�s menus, for simplicity in reading the code, I want to write a separate java file for each menu. For example I want a file.java, edit.java etc�.
    Since I�m not a professional I�m having problems in calling the variable �bar�, that I created in senior.java,
    In Senior.java I have :
    JMenuBar bar = new JMenuBar();
    setJMenuBar( bar );
    In fileMenu.java I want to add file menu to the menu bar �bar�:
    bar.add( fileMenu );
    When I compile the fileMenu.java I got a �cannot resolve symbol � message, where symbol is the variable bar.
    Can you please help me, knowing that i'm using SDK1.4.1?

    Sun has recommendations for naming conventions. Class names should start with a capital letter. You should avoid using class names that are the same as classes provided in the SDK. Following these conventions will make it easier for people to help you. For example, you should not use file, nor should you use File. It's better to use MyFile, replacing My with something that makes sense to your application (SeniorFile?).
    Also, check the Formatting Help link when posting for a desciption on how to use the code tags for posting code.
    1. You need to establish references between your classes. One way is to have a constructor that has a JMenuBar argument.
    2. You can not add a file to a JMenuBar because a JMenuBar adds a JMenu. I don't think you want file to extend JMenu. It may be better for file to have a JMenu.
    I haven't tried to compile this code so no guarantees - just trying to show you an approach.
    public class Senior extends JFrame {
       public Senior() {
          JMenuBar bar = new JMenuBar();
          MyFile file = new MyFile(bar);
    //whatever else you need
    public class MyFile {
       public MyFile(JMenuBar mbar) {
          JMenu menu = new JMenu();
          mbar.add(menu);

  • Instantiating an Array declared in a class from another class

    Hi Guys,
    I am working on a project for University and I'm stuck with this thins, which I'm sure is pretty easy when you know how...
    I have a first class "Courses" in which I declare my Array, here is the code:
    import java.util.*;
    public class Courses
    private String[][] Listing;
    Courses(String[][] l)
       l = Listing;
    }This class compiles just fine but I have 2 problems:
    1/ Can I make sure that this array will be [3][4] ?
    When I try : "private String[3][4] Listing;" or "Courses(String[3][4] l)" the class doesn't compile anymore...
    FYI: I want to store the followings in my array:
    French Language, 250, 130, 70
    Painting, 270, 140, 70
    Yoga, 250, 130, 70
    2/ How can I instantiate this from another class?
    From a class "Booking" I want to be able to create a new array "Listing" by calling my constructor from the Courses class and populate it with the above data (course,full-time price, part-time price, Concessions price )
    How do I do that?

    Thanks, I've modofied my code as follows:
    import java.util.*;
    public class Courses
    private String[][] Listing = new String[3][4]; //create array 3 rows * 4 columns
    Courses(String[][] l)
       l = Listing;
    int i;
    int j;
    int p;
    String t;
    String p1;
    String getTitle(int i)  //return Course Title
       t=Listing[0];
    return t;
    int getPrice(int i, int j) //return Price (Full-Time, Part-Time, Concessions)
    p1=Listing[i][j];
    p=Integer.parseInt(p1);
    return p;
    now from my nex class Booking I want to instantiate Courses:
    public class Booking
    Courses c = new Courses()
    }How do I actually pass the data to this...what's the syntax so that my instance will be:
    c[0][0]="French Language"
    c[0][1]="250"
    c[0][2]="130"
    c[0][3]="70"
    c[1][0]="Painting"
    c[1][1]="270"
    c[1][2]="140"
    c[1][3]="70"
    c[2][0]="Yoga"
    c[2][1]="250"
    c[2][2]="130"
    c[2][3]="70"
    Thanks in advance,
    Tom

Maybe you are looking for

  • Vertical output of a result?

    I need only one record from table and when i get report i am getting results from top to bottom in tabular form, how can i get these results form left to right. Thanks in advance Maz

  • BW BEx using a wildcard  ("*")???

    Hello BW Gurus, Does anyone know if it’s possible to select characteristics in BW BEx using a wildcard-like (“”) approach.  For example, if you wanted to filter on 6 digit GL Accounts that start with a 3 and end with a 1 (“31”).  I can seem to come u

  • Compare Old Value (Session State) with New Value on Submit.

    Hi all, Is there an easy way to do comparison of Old Value (Session State Value) with the New Value? is there an API for that? like what we have in PLSQL Trigger :NEW & :OLD Thanks before -Joel

  • Can't Successfully install 10.4.7

    ever since this update came out, its been giving me major problems installing. I just installed the 10.4.7 Combo Update from 10.4.0, it asked me to restart... then during startup, verbose login showed that it fell into a loop of some sort.. It kept s

  • Safari Crashes When Trying to Upload Files

    I have read a lot of posts here, but didn't find anything similar to my problem (sorry if this is a duplicate post). When trying to upload files or images to hotmail, yahoo, xdrive, photobucket, whatever.....safari crashes. And there's no crash repor