Classes in two files .java talk

Hello, if you have A class in a separate from your main application class in the main .java file source .java file, you can do something like this:

File main .java
Class myapp. {
ClassA joe = new ClassA();
Joe.doThis ();
Public int doThat() {...}

in the other .java file
Class ClassA {}
Int doThat() = result;
Public void doThis() {...}

What is needed is to see why the call to do can not see the method and has a compilation error, and regarding the call to doThat(), it will not work as is, but how to make the call...

TKS for your time, J.

Not sure, I understand that, but here are a few thoughts.

I'm going to take all these classes are in the same package, or you have used imports for the relevant classes.  I will also assume that the capitalization is not scheduled.

If the main java class you can do a

ClassA joe = new ClassA();

then it should be able to make a

Joe. DoThis()

I don't see how you can manage one without the other.

Now to give placed the possibility of returning to the class in the main routine, you pass a reference to an instance of the class.  Thus, for example, instead of

ClassA joe = new ClassA();

use

ClassA joe = new ClassA (this);

and change appropriately the manufacturer of finished and you should be able to call the method will be.

Of course, there is also the static option, but I guess that the treatment you want to do is specific instance.

I hope this helps.

Tags: BlackBerry Developers

Similar Questions

  • While the configuration of the JMS driver had error (caused by: java.lang.ClassNotFoundException: Files\Java\jdk1.6.0_45\bin\gmailcer tstore.jks)

    Hi all

    I have trid to configure the JMS

    -> down loaded the OpenSSL for win - 64. and configured by using the following steps:

    --> To open the certificate: openssl s_client-connect smtp.gmail.com:465

    -> certificate (mailsmpt.cert) copied to the location of the JDK,

    -> in compond to guest Ececuted certificate, after moving to the location of the JDL, it succeeded.

    -> I have before the JMS driver in Em console after recording, I had attached to the server, I get the following error.

    Exception in thread "main" java.lang.NoClassDefFoundError: Files\Java\jdk1/6/0_4

    5\bin\gmailcertstore/jks

    Caused by: java.lang.ClassNotFoundException: Files\Java\jdk1.6.0_45\bin\gmailcer

    TStore.JKS

    in java.net.URLClassLoader$ 1.run(URLClassLoader.java:202)

    at java.security.AccessController.doPrivileged (Native Method)

    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

    to Sun.misc.Launcher$appclassloader$ AppClassLoader.loadClass (Launcher.java:301)

    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

    The main class is not found: Files\Java\jdk1.6.0_45\bin\gmailcertstore.jks.  P

    the program will exit.

    gmailcertstore. JKS file exists in the location of "C:\Program Files\Java\jdk1.6.0_45\bin"

    Thanks in advance...

    This problem has been resolved,

    Actuallly, I installed the Weblogic Server on top of JDK which was in c:\\programFiles\Java\jdk1/6/0_45,

    And SOA server on top of JDK which was in c:\\oracle\middleware\jdk...

    I placed the "gmailcertstore.jks" in c:\\programFiles\Java\jdk1/6/0_45, instead of c:\\oracle\middleware\jdk. causing the problem for me.

    Thank you.

  • How to show two files together

    I have a folder for photos and inside a folder ("fertig") for the edited images, (under the direction and named photos stored separately in the subfolder).

    How to display the contents of the two files side-by-side? ~ br, Karl

    I assume you mean you want in two separate windows, instead of the tabs that you show in your screenshot.

    There are several ways to do so.

    And here's one: open the first folder, then control - or right click the folder fertig.

    If the first option, you see "Open in a new tab", then simply press the Option key and it will change to 'open in a new window '.

    (Even, if the default is to open in a new window, press Option changes to the new tab).

  • How to open/download a file .java instead of open as a txt in a new tab in Firefox?

    Hello
    I need to download/open on my computer a file .java, but Firefox does not give me a box 'Open' or 'Download' instead, it opens the java file as text in a new tab.

    How do I download/open it on my computer?

    I guess that you are referring to a JavaScript file.
    Java and JavaScript are different languages.
    To avoid confusion, see:

    If the server sends the file as a text/plain then Firefox will open the file in a tab if you click left and does not download/save the file.
    In this case, you must save the file via the context menu or the file menu.

    You will need to click right on the link and use "save the link under" to save this file directly instead of left-clicking the link.

  • I'm having a problem with the FireFox browser. I have attached two files that describe the problem. I have marked their A & B. A is the way it should lo

    I'm having a problem with the FireFox browser. I have attached two files that describe the problem. I have marked their A & B. A is how it should look like and B what happens once I have, I opened several tabs. I can get it back to normal if I click VIEW, click Customize. When the window customize appears that Firefox returns to its normal state. I have to click on the done button and go back to what I did. I tried to reset FireFox back to the default settings, but that has not fixed the problem.
    It started happening a month. Is there a way I can fix this? Thanks for your help. I don't know how to fix my 2 attachments that shows the problem I'm having.
    [email address removed to protect your privacy and security]

    Try disabling hardware acceleration in Firefox.

  • I recently changed my IE but when I try to import the Favorites I get only the first two files. How can I get my favorite of all THE? s

    I followed the advice and imported IE Favorites, but only the first two files have met. How can I get all THE files across please?

    Wow. I think I will like Firefox if the aid is so easily available, quick and as good as this. Fixed right away
    Thank you very much
    Kevod

  • What is the difference (if any) between iPhoto and iPhoto library? I managed to delete my pictures in freeing up space, but have a backup available. Do I have to download these two files in the pictures folder is one duplicate of the other?

    What is the difference (if any) between iPhoto and iPhoto library? I managed to delete my pictures in freeing up space, but have a backup available. I need to restore these two files in the folder images or one is one duplicate of the other?

    I use a MacBook Air 2013 model with a backup on a WD MyBook Duo disc for storage wireless as the Apple Time Machine.

    The Photos and the iPhoto library are totally separated - neither one is connected to the other somehow--you want to restore the library you need

    LN

  • View two files separately with the size of photo camera raw + jpeg in photo

    When I import my pictures from my camera, the format raw + jpeg in photo Apple, I see only the jpeg file, and the raw file is hidden. How can I see the two files? Thank you.

    Duplicate photo (command-d) and double click to enlarge, click on edit, and then in the image menu, select use RAW original title - giving you two - one with a J and the other with a badge of R

    LN

  • How to read two files (one updates every second, the other is constant) simoltaneously

    Dear all,

    I'd appreciate if someone help me.

    I want to read two files, one is the temperature that updates every second, and the other is energy hysteresis that has specific lines and is constant.

    I had a program in the discussion forum to read a file as it is updated. I checked this program in my case and it works.

    Then I added playback file hysteresis energy to the existing file. But while I run the program, the energy hysteresis file is read with all the lines.

    But the goal is that every time the updates of the temperature, I need to read a line of the file hysteresis energy.

    in this way every second, so, I have a new temperature data and a row of the other file.

    I tried to use 'for loop' inside the program, but it did not work, because the temperature reading will stop until that end of the loop.

    I joined the program.

    Could someone help me how read only a row of hysteresis energy file every time that the temperature updated?

    IS that what you wanted to achieve?

  • Had two files the same titled and deleted somehow the wrong file - how can I restore it

    original title: deleted the wrong file

    Had two files the same titled and deleted somehow the wrong file - how can I restore it - tried everything

    Hello

    This forum is for comments on the forums for answers. This should arise in the answers-
    Forums for your version of Windows Windows.

    Answers - Windows Forums
    http://answers.Microsoft.com/en-us/Windows

    -------------------------------------------------------------------------------------------------------------

    Recuva - free - recovers files deleted from your Windows computer, Recycle Bin,
    map of the camera digital or MP3 player. And it's free!
    http://www.Piriform.com/Recuva

    Forums - help here
    http://Forum.Piriform.com/

    I hope this helps.

  • How to compare the content of two files so I can delete duplicate records

    I'm trying to clean up several subfolders with duplicates without looking at the details of each record.  Is it possible in Windows XP to compare the content of two files whether they are an exact replica.

    Hi rav42010,

    Follow the steps in the article.

    Description of the tool in Windows XP disk cleanup

    http://support.Microsoft.com/kb/310312

    You can also use third-party app to perform the task using your favorite search engine.

    Note: Using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.

  • How can I change my default save HDD to my FAVORITES and DESKTOP files (I want to always work out laptop for these two files)?

    I travel a lot and always had problems with what files and update my portable media player. Finally, I feel I have the solution and until now it works fine except for two files. I have only about 8 files/important things I work on quite regular, then now, I set up the files on my laptop and managed to get them to be the main 'saved' from my office. In this way, when I go, all I need to do is to make a back-up of EXACTLY what is on my laptop and here I am. [I used to work on my desktop and I must then transfer the files to my laptop when I would need to travel, but inadvertently, is I would like to work on a file on my desktop before I left (but after the transfer) and when I got home from my trip that I would not forget to transfer the portable desktop files but would open and work on a desktop file before realizing that I] did not transfer.  So it would be a nightmare to have to compare each file to copy / paste new entries of the desktop and laptop to get a REAL current, updated file. Now I am working just on the laptop at work, and then on a trip (just have to make backups of a 8 files). My only two problems are that for the life of me, I can't find how to have FAVORITES and save on the laptop instead of the OFFICE desktop computer. Please tell me step by step how I do drive (portable) M be my default save to FAVORITES, and OFFICE to make the perfect solution for my high travels. Thank you

    you could try synctoy from microsoft:

    http://www.Microsoft.com/downloads/en/details.aspx?FamilyId=C26EFA36-98E0-4EE9-A7C5-98D0592D8C52&displaylang=en

    DB·´¯'·.. ¸ >-))) º > ·´¯'·.. ¸ >-))) º > share nirvana mann

  • two files imported from iTunes

    After you have converted my files of song iTunes to mp3s, I dragged my songs from my Mac on my Sansa Fuze player. Two files appear on my player: a song typical file and then an empty file with a track with a period, the feature of underscores, the follow-up album to number and the title song. For example, ._01Rhiannon for the first piece of my greatest hits of Fleetwood Mac album. This second file does not appear when I bring the reader on my Mac, and I can't remove the Sansa Fuze because you have to do this then that song, and do not play these files. Any advice on how to get rid of these files? Or how to avoid importing music in the future?

    See http://guyscharf.wordpress.com/mp3-on-macintosh/ for info on how to deal with the "AppleDouble" (. _ *) files.

  • Two files with identical (i.e., repeat) names

    When I look at my E drive in Windows Explorer, I have two folders named \Users in the root (using Vista with the latest updates). When I look at from a cmd box, I see only one.

    I think that the other was created when I used robocopy of Vista to save my files C e (for example "robocopy c:\Users\Steve e:\Users\Steve"), but (1) I don't think that you could end up with duplicated in the same folder names and (2) how do I specify which of the two files I want to copy files to?

    You cannot have two folders with the same name in the same directory: something must be different (perhaps underscore at the end of one thing or another).  I don't know how or why this happened.  When you scroll through each of the files are identical in terms of content (same issues, the same files, you can open files in both folders,...)?  I'm not familiar with robocopy, so I don't know if it was responsible (although it seems likely).  If they are identical in all respects, just remove one and use the other (or better, remame to something else and save it elsewhere "just in case" - at least until you do not know the folder that you have selected the proper functioning and there is no problem.)  I give it a month and then delete the other folder.

    If you see only a cmd then move some files to a different directory, then check on Windows Explorer to see what folder the change (and check that it appear in both).  Then you'll know which folder to use, and to rename are shown above.

    I hope this helps.

    Good luck.

    Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • I get the error message failed ti inittialize (0xc015004) when I try to open two files EMWave and Uniblue

    Original title: oxc015004

    I get the error message failed ti inittialize when I try to open two files EMWave and Uniblue everything worked well off I've updated my file is NOT at the four version

    Hello

    Provide more information on the file is NOT that you have updated.

    I suggest you try to uninstall and reinstall the programs and check.

    Reference:
    Uninstall or change a program
    http://Windows.Microsoft.com/en-us/Windows-Vista/uninstall-or-change-a-program
    Install a program
    http://Windows.Microsoft.com/en-us/Windows-Vista/install-a-program

Maybe you are looking for

  • Why is my file so BIG?

    Hello Recently, I made my first iMovie. It is about 13 minutes long, an art tutorial for youtube (do not know why this is important but...). When I finished the project and click on 'share on youtube' for a reason, that it says the file is a whole gi

  • arithmetic and manipulation of table

    I currently have a VI that reads and stores the values of a 1 d array in a 2D array.  I'm stuck trying to save the initial values of the Table 1 d perform arithmetic functions. I downloaded the VI and added a few notes in there to provide clarificati

  • Quicken 2006

    So I use Quicken 2006 because I've upgraded from Vista to Windows 7.  Now, all of a sudden, I get an error that says: "the program can't start because MSVCR71.dll is missing on your computer.  Try reinstalling the program to fix this problem. "Any id

  • . ODM files could not be downloaded

    Downloaded Overdrive Console Realized secruity update. Downloaded Windows Essentials 2012 Audited file associations were right. Success Excerpts from library books. Download started Overdrive Console has received the following message is displayed. .

  • Since the last update installation, the option to export to Word does not appear.

    Since the installation of the last update, I can convert is more the word.  By clicking on the option to export PDF doesn't show me any options.  My account is closed to date.  I certainly don't want to pay for something that does not work.