Some questions on import statements.

When I see
import java.awt.*
import java.awt.event.*
am I on track interpreting this to mean that you want to be able to use any of the classes found in package java.awt?
why would import java.awt.event.* be necessary if event is a class in the java.awt.* package you're importing in the second import statement up above?
does * mean like a "wildcard" which allows you to utilize
anything that is part of java.awt?

It allows you to use any of the classes in that directory, but not any classes in sub-directories of that directory.

Similar Messages

  • Question about import statements

    Why is it that I must have the import statement on the
    same frame
    and same layer
    as the AS code that utilizes the Class that I am importing?
    At least that is how it appears.

    Because that is how it works.
    Remember, import doesn't actually "import" anything. It is
    just a shortcut so you don't have to type the whole package name
    every time you use the coded in your example.
    It is actually kind of nice when you come back to code later
    or if you open somebody else's code (that you have to update or
    change) and to see at the top, "Oh, this bit of code has a reliance
    on class blah.blah.Yadda." In a way it kind of helps enforce a bit
    of good coding practice.

  • Java Newbie Question - the import statement

    Hi Geeks,
    I have a problem for importing a java .class in my project. This latter is named "Tedetis_New". Inside it, I created a "src" folder containing all the source code of the application. I import a jar file inside the parent directory of "src" (i.e. at the root of the project). Inside this jar archive, two classes (.class files) are not placed inside a package (default package according to eclipse), let's name one toto.class. So when I want to import toto.class from a file inside the src directory I simply do "import toto.class" but this statement doesn't work ! I don't manage to import my toto.class so ... what do you propose for this ?
    Thanks.

    Don't use the "default" class for anything serious;
    you can't import such a class.Er, package maybe?Yes, I was editing my reply while you replied to my reply so I couldn't
    edit my little blooper in my reply anymore; thank you very much Sir ;-)
    kind regards,
    JosI entered that response as quickly as I could, for just that reason. I
    thought you might notice and try to correct it, and I wanted to preserve
    your fuckupus maximus for all eternity.
    Everyone gather round and taunt Jos! Wave your private parts at his
    auntie! Fart in his general direction!
    Now, aren't you glad you didn't say "Jehovah"?I already knew that you were the one who invented amiability ;-)
    kind regards,
    Jehov^H^H^H^Hos

  • Some questions about importing HTML files

    Hi, folks
    Let's suppose we want to import a pack of HTML files formatted in HTML5 wit's it's CSS into a double-oriented folio. A couple or three questions about that, please:
    1. Is there a limit for a reasonable quantity of HTML files I can import into a folio? I mean.. 100 would be way too much, for instance?
    2. These HTML files could be navigated and referenced from inside TOC-pages made in InDesign,right? (navto://..., I gues?)
    2. Will it be possible, by means of HTML adaptative design techniques, to treat both orientations (vertical and horizontal) as different viewports or screen sizes so that the design adapts for instance the column width with its CSS?
    3. That said, will the InDesign final app. respect that adaptative CSS rules?
    I am asking this because we are looking for a way to inject big quantities of content with a very similar design into our application in a really fast and automatizable way and I have the suspicion* that importing HTML5 preformated CSS files could be the a very good and simple alternative to importing XML into InDesign templates as we start out content as tagged almost-html files.
    Thanks a lot
    Gustavo Sánchez (Posting from Madrid)

    I assume you are asking about using HTML articles.
    1. There is no limit beyond simply keeping things reasonable.
    2. Yes. Just use navto://articlename
    3. Yes. I've used min-width of 768 and max width of 1024 to control it.
    4. InDesign does not enter into any of this with the exception of using the folio builder panel. Everything else is done in Dreamweaver or whatever program you decide to use for the article.
    If you want to restrict the HTML articles to one orientation or the other, use the _h and _v suffixes.
    Bob

  • Newbie question about import statement

    Lets say for example I have a class A and a class B.
    Then lets say I import class A into class B.
    If I instantiate some objects and methods in class A
    Will I be able to access them in class B.
    Thanks gemann

    Imports are used to import classed from another package.
    Conside a package named package1 and class named A in it.
    package package1;
    public class A{
      //public method
      public void publicmethod() {}
      //private method
      private void privatemethod() {}
      //default method
      void defaultmethod(){}
      //protected method
      void portectedmethod(){}
    }Now conside another package named package2 having a class B.. and you want to make an object of class A and want to call its method..
    package package2;
    import  package1.A;  // or import package1.*   it imoprts every class in this package
    class B{
    B(){
    A a=new A() ; // possible since we imported it..
    a.publicmethod() // possible since it is public method
    a.defaultmethod()// Not possible. since it is a this is in a different package
    a.protectedmethod()// Not possible since this is in  a different package, and this is not a derived a derived class of B
    a.privatemethod() // Not possible since it is private
    }Hope it is clear now..
    appu

  • Some Questions on Import/Export using SQL*Plus

    Could somebody help me by answering the following queries? I couldn't find the answers in this forum or the User Guide.
    1. Can we create an application or page export without using the web front-end? E.g. Call some pl/sql, get a file on db server...
    2. Can we change the application id within an application/page export? It looks like it is only referenced a few times in the script (set package variable, wwv_flow_api.remove_flow, wwv_flow_audit.remove_audit_trail, wwv_flow_api.create_flow, thereafter uses package variable)
    3. Can we change the workspace within an application/page export? It looks the workspace is set with wwv_flow_api.set_security_group_id(p_security_group_id=>719307052588490). Is a 'security group' a synonym for 'workspace'?
    4. Supposing I wanted to transfer only the shared components of an application from one DB to another. Could I achieve this by first exporting every page of the target app individually, then import source app over target app, then re-import each individually exported page over target app?
    Thanks!

    1. Yes. Search this forum for command line export. The command line export utility is on the Studio at http://apex.oracle.com/studio
    2. I wouldn't do that. The application id is probably used (indirectly) to generate foreign
    keys (template ids, offsets and such).
    3. Same answer as (2).
    4. There is no way to export/import only the shared components.

  • Question about import statement

    Hi all!
    I was wondering if a line like this:
    import java.io.*imports all classes from java.io or just the classes needed by your program (the classes you actually using in your code). Can anyone give me a little hint on that?

    The way I understand it is that it simply makes the
    classes in that package 'visible'. This means that you
    don't have to type the fully qualified name each timeOh, yeah. I was thinking too much in C and it's #include.
    Thanks :-)

  • Questions on Room State

    Hey guys,
         I got some questions on room state:
         1) Does the room state actually take some effect or just an indicating flag? For example, if a room state is ROOM_STATE_ENDED, will it prevent any incoming user connection?
         2) I tried to login as a guest, the room setting is HostNotArrived. Then I logged in as an owner. The state was switched to Active. The result seems fine until now. However, when I quit the owner app by closing the brower tab, and checked the quest page, the room state was still in Active, rather than switch back to  HostNotArrived or any other state. Is it an expected result? How can I let the room state update to date if the owner quit in this way?
         3) For my scenario, I'd like to build a room only avaiable when owner arrived. That is, if a guest arrived before the owner arrived or after the owner left, he will not be allowed to do anything , even the connection should be rejected. Is that possible?
         Thanks a lot!
    Jinni

    Hi Jinni,
      1) It should prevent any incoming connection other than OWNERs of the room.
      2) HostNotArrived happens only before a room has been "kicked off" by the owner, and not afterwards (even if the owner has left the room, it's still fair to say he had "arrived").
      3) I'm not sure there's a perfect way to do this yet. We'll be looking into this use case, which feels like you need some "server-to-server" integration : the ability to detect an owner has left, then a way to shut down the room. Does that seem right to you? For now, a quick way of achieving the functionality (if not the security) is to have your clients detect that there's no owner, and disconnect.
       hope that helps
       nigel

  • Some questions about 4s the answers which i can`t find at now.

    Hi all! I seen the manual, but have some questions.
    Important for me:
    Fonts notes - change except three in the settings?
    The dialing buttons with one touch? Except now - "Phone - buttons"
    Is there a group of contacts? On the sim card, I do not keep contact.
    Can i rate a song in a standard player?
    Can you give the name of the best player for FLAC format?
    Sync photos in Itunes, indicates one folder, and you can specify all that are nested inside? so?
    How do I know whether the information is sent (hidden) or packages gprs without my permission? At now I turned off not needed for me apps.
    Can I change the capital letters on the keyboard in the messages to the normal small?
    "Reminder" of the event calendar. Options: No, at the time of the event, for 5, 15, 30, for 1 hour, 2 hour .... 1 day, 2 days. Wow!? And where is the option for 3-4-5 hours? If I need it.
    Too conglomeration and confusing menu Itunes. Intricate synchronization. I can not understand where to get my photos from my phone to PC (Win7 x64).
    The battery is not recommended to fully discharge, right? It is better to charge when it near 20% or it`s don`t care?
    Not quite clear things:
    The maximum volume of the music can really mess up a rumor, it's amazing, you can limit the maximum mode in the settings, check with the monitor Senheiser HD215.
    Free Appstore often not free or demo, ask for a fee, why mislead people is not clear!
    Thank for answers!

    Lawrence Finch Thank you very much for answers!
    1-2. I am really forgot about apps in store. ))
    3. It is strange that there are no groups in the phone, it's still a phone in the first place ))
    4. I meant in the iphone. )) On the computer I have many years using a different program for music.
    5. Hmm... flac is not video format.
    6-7. Ok
    8. I am talking about standart letters on the keyboard in the messages. Visually, they look like big letters, that I first met in the phone. In small letters ordinary phone as long as you do not choose a large and they vary in height.
    9-10.  Ok
    11. ???
    The battery is not recommended to fully discharge, right? It is better to charge when it near 20% or it`s don`t care?
    Not quite clear things:
    12. I checked the maximum volume with my Senheiser HD215 and it`s a very very loud. What is strange that you can limit the maximum volume mode in the settings. This maximum volume limit seems to me strange.
    13. Ok. But I was faced with a situation where there is an update itunes says, and as detailed a description of the program, but not a change in her. Strange.

  • Some question About title importer plugin

    We are developing a title importer plugin for CS6, and have some question, hope forums could help me. Thank you very much.
    1) Is there API to get title clip's in, out point in timeline ?
        in imImageRec data structures, these is a in/out point, but it is trim in/out point, is not timeline in/out, how to get these point ?
    2) Because we are also developing a subtitle importer for CS6, when user want to record the subtitle timecode, we hope we could control timeline play/stop, and get the playing/stopped callback, in same time, we could get the current playing position. But, it seems that these is no way to do this. I want to known, is there any plan to support these features in future ? Or, is there some work around methods to get these ?

    I really appreciate your reply, I will look for VideoSegmentSuite to get the in/out point.
    Q: Why we need timeline in/out of title clip ?
    A: Our titler could do animation, when user strench title clip in timeline, clip's length will be changed, we hope we could scale animiation to fit the new length. ( I means animation will be slower or faster with new length), in imImporterImageRec, there is a in/out point and postion, but, we found they are not correct in sometimes, and SDK help PDF tell me there is a API bug in it, is it fixed or not ?
    In another, in ImportImage API, we use (Rec->pos + Rec->in) / Rec->sampleSize to get real frame number for out title clip rendering when our title is imNoDurationNoDefault, we test it, it seems that it is right. But if our title is imNoDurationStillDefault, then Rec->pos and Rec->in and Rec->out are all based 90000+, and Rec->out was not right in some times (when we strench clip's outpoint in timeline), it is a bug or we missed something ? In this situation, we have to use (Rec->pos - Rec->in) / Rec->sampleSize to get the rendering frame number, it seems that it is right too. But, we could not use Rec->out, because it was wrong in sometimes.
    New questions:
    1) When we dragdrop our title files to timeline directly from windows explorer, Premiere will call imGetInfo8 (in here, we will allocate a private data for this clip), imOpenFile8, and there is no chance to call imGetPrefs8, so, when we close Premiere, imCloseFile will not be called for this clip, memory leaks for our private data. If we drag the title files to Premiere Bin firstly, then Premiere will call imGetPrefs8, imGetInfo8, imOpenFile8, there is no problem, imCloseFile will be called when we release this title clip. 
    So, my conclusion is: Premiere must call imGetPrefs8, else imCloseFile will not be called, I think it was a bug, isnot it?
    2) We have a title template library (they are all based template title file), and, we use OLE dragdrop (COleDataSource->DoDragDrop), when we drag-drop these files to Premiere Bin/Timeline/SourceMonitor/TargetMonitor, there is a lots of memory leaks in oledobj2.cpp (microsoft source code files for COleDataSource), we are sure our code is correct, because if we dragdrop to our windows or other NLE (for example, EDIUS), there is not any problem. So, I guess, because we use MFC, and Premiere did not support it fully? Do you have see this problem before ?  Do you have another suggestion to do these drag-drops ?
    3) About to get sequence start timecode, we see a thread in forum which said there is new sdk headers, use them, we could get it through PrSDKSequenceInfoSuite. But its downloading link is broken, so, how to get new SDK headers? could you give me a new link to download ?
    BTW, we are useing CS6 SDK Release2 + CS6, and will upgrade to 6.03 to test.
    Thank you very much. and Sorry for these lots of questions, I am new guy in Premiere plug-ins developing.

  • Import statement question

    what's the difference between
    import java.util.Vector;
    and
    import java.util.*;
    is there any difference in bytecode generated? or time takes to compile?
    what's the best practice?

    Yes there is a best practice, it's the one you mentioned. Use the more specific import statement. If you're only using one or two classes from a package, explicitly name them in the import statements. That way somebody else reading your code (which includes yourself, six months later) can immediately get a better understanding of your code.
    If this rule is followed, and you see this as the first line of a source file:
    import java.util.StringTokenizer;
    then you know the StringTokenizer is being used. But if you saw this:
    import java.util.*;
    you wouldn't know which one is being used until you're deep in the code.
    Knowing right away whether a class is tokening a string, versus say using collections, makes it a lot easier to read.
    You should only use the whole-package include if you're importing a really big part of the package. For example:
    import java.awt.*;
    is probably OK because it's relatively unlikely a person will use only a couple classes from that package.

  • Newbie question : import statements

    So, i'm a complete java newbie trying to make his first swing application, a basic calc. I download NetBeans 6.5, install it, and begin to code. I quickly learn about the Matisse GUI editor, find it very easy to use, and in a couple hours, the work is done and runs very fine.
    But looking at my code, I realize I have forgotten all import statements (like import javax.swing, import java.awt.event ....), nevertheless the application runs fine. I suppose then that the Netbeans compiler automatically corrects my mistakes, but I want to do it right.
    So, I write the import statements explicitly in my code and I get a warning message : "import unused". After that, I find out about the "fix import" tool in Netbeans, use it and all my import statements disappear. I guess i'm missing something here.
    I thought import of swing classes were mandatory to write a swing application. I have NO import statement in my code, even if I'm using jFrames, jButtons, event handlers and the program works fine, why ?
    Would I be able to compile this importless code in another environment (let's say Eclipse or even javac) ?
    I'm using JDK 1.6 and Netbeans 6.5 with Windows XP.
    TIA

    glawen wrote:
    Ok, thanks for the answers, and sorry for my misinterpretation of BigDaddyLoveHandles's first post. I understand now, the import statements are useful only if you don't want to write full class names, and the generated code uses full class names so no import needed.Please also understand BigDaddyLoveHandles's latest post. If you learn to code Swing with NetBeans' Matisse, then you will be learning Matisse, not Swing. When it comes time to try to tweak or upgrade your program, you will be lost. Better is to learn Swing from the ground up by going through the Sun Swing tutorials. Though having said that, if you are very new to the language, better still is to learn the fundamentals of Java first before embarking in the murky waters of GUI programming. Best of luck to you in your endeavors.

  • NewBee question - Import statements

    Hi,
    I am new to Bea workshop.
    Can someone help me out in how to add my own Import statements in Java classes
    created in workshop.
    Thanks and Regards,
    Nikita

    Hi Nikita,
    Welcome to Workshop!
    The JWS classes used in Workshop are essentially Java classes with the
    additional capability to understand the JWS metatags in the comments.
    Hence you can use the import statements in the same manner as you use in a
    normal Java class.
    Please do let us know if you have any further queries.
    Regards,
    Anurag
    Workshop Support
    "Nitika" <[email protected]> wrote in message
    news:[email protected]..
    >
    Hi,
    I am new to Bea workshop.
    Can someone help me out in how to add my own Import statements inJava classes
    created in workshop.
    Thanks and Regards,
    Nikita

  • Import statement is not working

    hi everybody,
    I have a directory under which I have a number of sub-directories. Lets call this directory "parent_directory". under this directory I have another directory called "child_1". Under "child_1" I have another subdirectory called "child_2". Now I have a code in child_2 that has the following statement:
    import program_1;
    //this is a program present in the parent directory. lets call it
    //program_1.java
    when I am compiling I am getting an error saying:
    program_2.java:28: '.' expected
    import program_1;
    ^
    1 error
    program_2.java is the program present in child_2 in which I have included the import statement.
    If I change the ";" to "." then again error appears as the import statement only needs the name of the class and doesnot need the extension.
    I will be very grateful to you if you could please suggest me a way around this.

    This questions belongs in the "New to Java" forum ...
    sigh
    Anyways, import works on package names with trailing * or full qualified class names, e.g.import mypackage1.*; // imports all classes in mypackage1
    import mypackage2.MyClass2; // imports MyClass2 from mypackage2So instead of import program_1; you need to do
    1. ensure that program_1 is in some package
    2. ensure that your directory structure mirrors your package structure (same names!)
    3. ensure that your CLASSPATH is either not set at all or points to the parent dir of your topmost package
    Example:
    Directory structure:C:\tmp\java\top\
    C:\tmp\java\top\MyClass1.java
    C:\tmp\java\top\bottom\
    C:\tmp\java\top\bottom\MyClass2.java
    CLASSPATH=".;<java install dir>\jre\lib\rt.jar;C:\tmp\java"Source for MyClass1.java:package top;
    public class MyClass1 {
    }Source for MyClass2.java:package top.bottom;
    import top.MyClass1;
    public class MyClass2 {
      private MyClass1 myClass1;
    }

  • Import statement and directory structure

    First of all, sorry for such a long post, I believe part of it is because I am unsure of the concept of importing in Java. Secondly, Thanks to anyone who can ultimately enlighten me to the concept of import. I did ask this question before in the "erorr and error handling" forum, and the people who have helped me there did a great job. But, I believe I require a little more clarification and thus have decided to post here.
    Anyhow, my question..
    Could someone explain to me the concept of the import statement, or direct me to a webpage with sort of explanation for newbies? For some reason, I am having a hard time grasping the concept.
    As I understand it, the import statement in Java, is very similar to the namespace keyword in C. That is to say, import doesn't actually "import" any source code, the way that the #include statement does in C.
    So I suppose what my question is, say I have a java class file like below:
    //filename: sentence.java
    //located: c:\school\csc365
    package csc365;
    class sentence
    //some variables here..
    //some constructor here..
    //some methods here..
    And some sample program like the one below which implements the above..
    //filename: test.java
    //located: c:\school\csc365
    import csc365.*;
    import java.io.*;
    class test.java
    //creates some sentence object
    //uses the object's methods
    //some other things.
    As I understand it, the test.java file should not compile because the csc365 package is not in the correct directory. (assuming of course, the classpath is like c:\school\csc365;c:\school )
    But, ... where then should the sentence.java be located? In a subdirectory of c:\school called csc365 (i.e c:\school\csc365\) ?
    And thus that would mean the test.java file could be located anywhere on the hard drive?
    I suppose, I just need a little clarification on the correlation between a package's "name" (i.e package csc365; ) and its corresponding directory's name, and also how the javac compiler searches the classpath for java classes.
    ..So, theoretically if I were to set the classpath to look in every conceivable directory(provided the directory names were all unique) of the harddrive, then I could compile a test.java anywhere?
    As a note: I have been able to get the test.java file to compile, by leaving out the import statement in the test.java file, and also leaving out the package statement for the sentence class, but I assume this is because the files are defaulted to the same package?

    Hi Mary,
    No, import isn't analogous to C++ namespace - Java package is closer to the namespace mark.
    import is just a convenience for the programmer. You can go your whole Java career without ever writing an import statement if you wish. All that means is that you'll have to type out the fully-resolved class name every time you want to use a class that's in a package other than java.lang. Example:
    // NOTE: No import statements
    public class Family
       // NOTE: fully-resolved class names
       private java.util.List children = new java.util.ArrayList();
    }If you use the import statement, you can save yourself from typing:
    import java.util.ArrayList;
    import java.util.List;
    public class Family
       // NOTE: fully-resolved class names
       private List children = new ArrayList();
    }import isn't the same as class loader. It does not bring in any source code at all.
    import comes into play when you're compiling or running your code. Java will check to make sure that any "shorthand" class names you give it live in one of the packages you've imported. If it can't find a matching fully-resolved class name, it'll give you a message like "Symbol not found" or something like that.
    I arrange Java source in a directory structure that matches the package structure in the .class files.
    If I've got a Java source file like this:
    package foo.bar;
    public class Baz
       public static void main(String [] args)
            Baz baz = new Baz();
            System.out.println(baz);
       public String toString()
           return "I am a Baz";
    }I'll store it in a directory structure like this:
    root
    +---classes
    +---src
          +---foo
               +---bar
                    +---Baz.javaWhen I compile, I go to root and compile by typing this:
    javac -d classes foo/bar/*.javaI can run the code from root by typing:
    java -classpath classes foo.bar.BazI hope this wasn't patronizing or beneath you. I don't mean to be insulting. - MOD

Maybe you are looking for