Question about syntax

hi,
If I have a class like this...
public class Sample implements ActionListener{
       Socket s;
      Button test = new Button("TEST");
    Button boo = new Button("boo");
    PrintWriter out = new PrintWriter();
    public Sample(){
    test.addActionListener(this);
     public void actionPerformed(ActionEvent e ){
     if(e.getSource()==test)
      s = new Socket("local host", 8888);
     else if(e.getSource()==boo)
            out.println("testing..");
when someone presses the test button, (which would create the socket,) and then presses the boo button, is the socket still available or do I have to instatntiate  it again?
Thanks alot

public class Sample implements ActionListener
Socket s;
Button test = new Button("TEST");
Button boo = new Button("boo");
PrintWriter out = new PrintWriter();
public Sample()
test.addActionListener(this);
public void actionPerformed(ActionEvent e )
if (e.getSource()==test)
s = new Socket("local host", 8888);
else if(e.getSource()==boo)
out.println("testing..");
When someone presses the test button, (which would create the socket,) and then
presses the boo button, is the socket still available or do I have to instatntiate it again?
Thanks
If the user presses the test button first, an object of type Socket is instantiated,
which is local to the actionPerformed() method. It will be accessable within that
method. However, If the user clicks on the boo button first, it will not be accessable
because it hasn't been instantiated yet.
Jeff.

Similar Messages

  • Question about syntax in procedures

    I've worked with SQL-based environments for a few years but just now getting into Oracle.
    This is probably a very simple question, but why do some commands have to be wrapped in an EXECUTE IMMEDIATE statement within a procedure? For example, the following procedure compiles with warnings but does not execute (generates an error message):
    CREATE PROCEDURE MY_PROC
    AS
    BEGIN
    DROP TABLE ABC;
    CREATE TABLE ABC AS SELECT * FROM XYZ;
    END
    But, this procedure compiles and executes just fine (assuming, of course, the existence of table XYZ):
    CREATE PROCEDURE MY_PROC
    AS
    SQL_STMT varchar(4000);
    BEGIN
    SQL_STMT := 'DROP TABLE ABC';
    EXECUTE IMMEDIATE SQL_STMT;
    SQL_STMT := 'CREATE TABLE ABC AS SELECT * FROM XYZ';
    EXECUTE IMMEDIATE SQL_STMT;
    END
    Why does one have to do that? Which other keywords need to be "wrapped"?
    Thanks in advance for your help.
    Carl

    Hi,
    There are PL/SQL commands for DML statements (INSERT, UPDATE, ...) that work like the corresponding SQL commands. In fact, they work so much like the corresponding SQL commands that you might not even realize they are different!
    There are not PL/SQL commands for CREATE TABLE, DROP TABLE, and most other SQL commands. To do these things from within PL/SQL, you have to use
    EXECUTE IMMEDIATE.
    Edited by: Frank Kulash on Mar 24, 2009 4:28 PM
    See the [PL/SQL manual|http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/static.htm#BABGEDAE] for more details.

  • Two questions about Risk Management 2.0

    hi experts,
    Please find below two questions about Risk Management:
    -In SPRO, Risk Management>Create top node: after completing information and executing I have this error:
    Error in the ABAP Application Program
    The current ABAP program "/ORM/ORM_CREATE_TOP_NODES" had to be terminated
    because it has
    come across a statement that unfortunately cannot be executed.
    The following syntax error occurred in program "/ORM/SAPLORM_API_SERVICES " in
    include "/ORM/LORM_API_SERVICESU10 " in
    line 97:
    "Bei PERFORM bzw. CALL FUNCTION "GET_ORGUNIT_THRESHOLDS" ist der Aktual"
    "parameter "I_ORGUNIT_ID" zum Formalparameter "IV_ORGUNIT_ID" inkompati"
    "bel."
    The include has been created and last changed by:
    Created by: "SAP "
    Last changed by: "SAP "
    Error in the ABAP Application Program
    The current ABAP program "/ORM/ORM_CREATE_TOP_NODES" had to be terminated
    because it has
    come across a statement that unfortunately cannot be executed.
    Do you know where it could come from?
    -On the Portal>Risk Management
    when I click in a link under the risk management menu(activities and risks, risk report, document risk,...) i alway have an internal server error:
    While processing the current request, an exception occured which could not be handled by the application or the framework.
    If the information contained on this page doesn't help you to find and correct the cause of the problem, please contact your system administrator. To facilitate analysis of the problem, keep a copy of this error page. Hint: Most browsers allow to select all content, copy it and then paste it into an empty document (e.g. email or simple text file).
    Do we have to set up some customizing points before accessing these links?
    Thank you !
    Regards,
    Julien

    Hi Julien ,
    I have the same error what u described as :-
    -On the Portal>Risk Management
    when I click in a link under the risk management menu(activities and risks, risk report, document risk,...) i alway have an internal server error:
    While processing the current request, an exception occured which could not be handled by the application or the framework.
    If the information contained on this page doesn't help you to find and correct the cause of the problem, please contact your system administrator. To facilitate analysis of the problem, keep a copy of this error page. Hint: Most browsers allow to select all content, copy it and then paste it into an empty document (e.g. email or simple text file).
    Do we have to set up some customizing points before accessing these links?    "
    Are you able to solve this. Please let me know how to resolve this???
    Thanks
    Regards,
    Atul

  • Questions about supporting TLF with Halo components in Flex 4.1

    We recently decided to upgrade to the Flex 4.1 SDK after a year or so at 3.2.  We have been asked to not use the new SPARK components yet because our products would then have a mistmatch of Halo and Spark components in the UI.  We have built support for our Halo components to display html through the ".htmlText" property for the Text components.  For example, we can display strings such as "<p>Choose <b>one</b> option:</p>".  With the upgrade to Flex 4.1 a couple of questions about supporting bi-directional text have come up.  My understanding is that in order to support bi-directional text we need to use the Text Layout Framework.  Does anyone have a suggestion on how we can utilize the TLF with the Halo components in Flex 4.1?    Can we still use the ".htmlText" property somehow or is there a new property that understands the TextFormat markup?  We would love to still be able to use the limited html tags that are supported for the "htmlText" property.  Is there an option where that syntax is still understood?
    Thanks in advance!
    David

    The halo components use TextField, and the spark components use TLF. Both sets have support for some html markup to import and export text. To use bidi text, you have to use TLF; TextField won't work properly.
    It is possible to use TLF to build your own components, and this can work well particularly for applications with specialized needs. But if you need bidi support for advanced components like DataGrid and List, then you should use the spark components.
    Thanks!
    - robin

  • Questions About JSP?

    hi;
    I am php devloper and I am learning Java now.
    I am using NB6.1 , Tomcat 6.0 , J2ee 5.
    I have some questions about devleoping web application with jsp.
    1.What are
    /WEB-INF/web.xml
    /META-INF/context.xml
    /META-INF/MANIFEST.MF
    files that generated with NB.are important or optional.are auto generated or may I edit.
    2.can I distribute my web application in non text format.How?
    3.if I want to add some files to my application that its running in tomcat.how can i do that with out rebuild all.
    thank you
    Add to mtz1406's Reputation

    thank you all for helping.
    I will write more information about my questions may this help others:
    *{ /WEB-INF/web.xml* - The +Web Application Deployment
    Descriptor+ for your application. This is an XML file describing
    the servlets and other components that make up your application,
    along with any initialization parameters and container-managed
    security constraints that you want the server to enforce for you.
    This file is discussed in more detail in the following subsection.
    As mentioned above, the <code>/WEB-INF/web.xml</code> file contains the
    Web Application Deployment Descriptor for your application. As the filename
    extension implies, this file is an XML document, and defines everything about
    your application that a server needs to know (except the context path,
    which is assigned by the system administrator when the application is
    deployed).
    The complete syntax and semantics for the deployment descriptor is defined
    in Chapter 13 of the Servlet API Specification, version 2.3. Over time, it
    is expected that development tools will be provided that create and edit the
    deployment descriptor for you. In the meantime, to provide a starting point,
    a [basic web.xml file|http://localhost:8080/docs/appdev/web.xml.txt]
    is provided. This file includes comments that describe the purpose of each
    included element.
    NOTE - The Servlet Specification includes a Document
    Type Descriptor (DTD) for the web application deployment descriptor, and
    Tomcat 6 enforces the rules defined here when processing your application's
    <code>/WEB-INF/web.xml</code> file. In particular, you must
    enter your descriptor elements (such as <code><filter></code>,
    <code><servlet></code>, and <code><servlet-mapping></code> in
    the order defined by the DTD (see Section 13.3).
    h4. } from tomcat documentation
    Tomcat Context Descriptor
    bq. A /META-INF/context.xml file can be used to define Tomcat specific \\ configuration options, such as loggers, data sources, session manager \\ configuration and more. This XML file must contain one Context element, which \\ will be considered as if it was the child of the Host element corresponding \\ to the Host to which the The Tomcat configuration documentation contains \\ information on the Context element.
    }from tomcat documentation
    but I still want more information about this question:
    Q3: I want to distribute (sell to another organaization) without give sorce code in jsp files.So I want to precompile it to be just class files or jar files.
    I want to use ant that become with netbeans 6.1.can anyone give me information about how to do that.
    thank you again

  • Question about PL/SQL Function in report

    Hi all. I have a (basic) question about using a PL/SQL function in a report. In my report page I have an item (PL/SQL function) that has the following syntax:
    return username from t1
    where username like 'Le%'
    I reference this item in an email process. Ideally this function would return all usernames that begin with 'Le' in the drafted email; however, its not looping so I'm only getting a return on the first name.
    I have a few books on PL/SQL but I'm not exactly sure where to start - I imagine there is a loop process I need to integrate into the function but, like I said, I'm not sure.
    I would have posted this to the PL/SQL forum but also wanted some feedback on whether or not using this method is the best way forward. Essentially I have a table with usernames and just want to send email messages based on some simple logic.
    Thanks!
    Len

    Hi Sergio,
    First, it's an honor to have you reply to my post. Thanks!
    To be more specific,
    T1 is a table containing the results from a user security scan. Username is a column in this table containing user names. What I have done is create a page in HTML DB with the following elements:
    1. An 'Item' containing the PL/SQL function that is hidden. The purpose of this Item is to generate information from T1 that meets the simple logic parameters - in this case, the user names that begin with "Le". I have called this Item P145_TT
    2. A 'Process' containing references to HTMLDB_MAIL. The 'Process' looks similar to this:
    HTMLDB_MAIL.SEND(
    P_TO => '[email protected]',
    P_FROM => 'Anon Email Account',
    P_BODY => 'Note: This message was automatically generated. Do not attempt to reply to this email.
    These are the users that begin with Le: '||:P145_TT||' ',
    P_SUBJ => 'Summary');
    3. A 'Button' to submit the process and (hopefully) send the message containing all users that adhere to the logic in the function.
    4. If I use 'return username from t1...' I will get a username generated, but like I said previously, it only gives me the first and does not loop.

  • Questions about use of InfoObjects

    Hi,
    I am generating profiles uisng the ODSs, and i have a question about the mapping:
    For IO 0TCTNIOBJNM, I am mapping it to 0HIER_NODE for text node .
    What should these be mapped to? What are these supposed to be?
    0TCTIOBJNM
    0TCTNODE
    Thanks
    Will

    Thanks so much for the reply.
    Before I posted my code, I double-checked my syntax and think I found the problem. I using Fragments at the beginning of my page, and at the end, to construct a wrapper table where I can put some fancier graphics, etc. I'm using the fragments and plain old HTML because using another gridpanel on each page is a bit cumbersome, and also I need the flexibility of possibly doing some dynamic things to this table... Because each fragment doesn't have matching tags to complete the page, I think that's screwing up the designer, as you suggested. For instance, here is my fragment at the top of each page :
    <TABLE WIDTH="100%" BORDER="1">
    <TR>
    <TD ALIGN="CENTER" VALIGN="TOP">
    <TABLE WIDTH="595" BORDER="2" CELLSPACING="0" CELLPADDING="0" BORDERCOLOR="#184266">
    <TR>
    <TD WIDTH="50%" ALIGN="LEFT" BGCOLOR="#184266"> </TD>
    <TD WIDTH="50%" ALIGN="RIGHT" BGCOLOR="#184266"> </TD>
    </TR>
    <TR>
    <TD COLSPAN="2" ALIGN="CENTER" VALIGN="TOP">
    <!-- WIZARD GRID BEGINS HERE -->
    Any suggestions on a better way to use includes to break out some necessary HTML??
    THANKS very much!
    Tom

  • Question about the custom panel language

    I have a question about the custom panel language...
    The document you provide seems to lack details on some features. Namely the icon and picture widgets. I see from looking at the examples and other vendor's web pages that these features exist, but I don't find any detailed descriptions of them in the documentation. Is there a more complete document describing these and other features...
    http://www.adobe.com/products/xmp/custompanel.html
    Alternatively, can someone fill me in on the syntax and options for at least the icon and picture widget. For instance, how do you load external icons or pictures...
    Tom

    Gunar,
    It could be interesting to have something like
    icon(url: 'http://www.adobe.com/Images/logo.gif', width: 20, height: 20);
    or better
    picture(url: 'http://www.adobe.com/Images/logo.gif', width: 20, height: 20);
    for the pictures and
    include(url: 'http://www.adobe.com/xml/custompanel/camera1.txt');
    for include the cusmtom panel's dynamic portions
    Juan Pablo

  • Question about calculation script 'Fix'

    Hi Guys,
    I have a question about calculation script 'Fix'. Below is the sample for my question:
    Dimension 'Period' has members '2009','2010','2011'. We want to Fix the data which 'Period' is not '2009'.
    From Database Administrator's Guide we could use @NOTEQUAL, but version 11.1.1.3.0 seems not support @NOTEQUAL.
    Actually, the dimension is dynamic so we cannot use the way fixing other memebers. What should I do for this requirement?
    Edited by: 842270 on Apr 24, 2011 7:29 PM

    842270 wrote:
    Hi Guys,
    I have a question about calculation script 'Fix'. Below is the sample for my question:
    Dimension 'Period' has members '2009','2010','2011'. We want to Fix the data which 'Period' is not '2009'.
    From Database Administrator's Guide we could use @NOTEQUAL, but version 11.1.1.3.0 seems not support @NOTEQUAL.
    Actually, the dimension is dynamic so we cannot use the way fixing other memebers. What should I do for this requirement?
    Edited by: 842270 on Apr 24, 2011 7:29 PMYou can use @Remove command to avoid 2009.
    @REMOVE
    Removes values or members in one list from another list.
    Syntax
    +@REMOVE (list1, list2)+
    Parameter     Description
    list1
    +     A list of member specifications, from which the members specified in list2 are removed.+
    list2
    A list of member specifications to be removed from list1.

  • [SOLVED] Question about GCC error messages.

    I'm currently taking a course in C programming, and I have  a question about the error messages returned by GCC.
    When ever i try to compile a program containing syntax errors, i get cryptic and not very helpfull error messages.
    If i try to compile:
    #include <stdio.h>
    int main(void)
    int i;
    i = 0
    return 0;
    I get following from GCC:
    error.c: In function â:
    error.c:8:2: error: expected â before â
    But shouldn't the message be something like:
    error.c: In function 'main':
    error.c:8:2: error: expected ; before 'return'
    or am I mistaken?
    /AcId
    Last edited by AcId (2010-10-13 17:48:19)

    Woah. That is very strange. I've never seen that before.
    I assume you're using Arch Linux. What text editor did you use to write the code? Which terminal application are you using?
    ...those questions are probably unrelated to the problem, but we might as well get them out of the way.

  • Question about port C++ code to C

    I have a newbie question about C++
    I'm being ask to port a C++ sharelib into a kernel driver for work so from C++ => C.  I'm not at all familiar with C++ but i'm making some leeway.  However i'm a little stuck, what does the following line of code in bold mean in C++ and how would I translate it into C code? 
    #include <deque>
    struct _buffer
        UINT8* buffer;
        UINT8 length;
    typedef deque< struct _buffer* > MSGQUEUE;
    I'm assuming it's type defining a deque of the struct _buffer???  but I'm confused by the <...>, what does that operator do in C++.  Is it defining a struct _buffer pointer within the deque??? 
    This might like a "DUH it means...." question to some people so sorry about the stupid question.
    --Vincent

    <> is template syntax and is generally the type of object a container holds..   So it is defining that the MSGQUEUE type is a deque holding struct_buffer*'s.

  • Questions about your new HP Products? HP Expert Day: January 14th, 2015

    Thank you for coming to Expert Day! The event has now concluded.
    To find out about future events, please visit this page.
    On behalf of the Experts, I would like to thank you for coming to the Forum to connect with us.  We hope you will return to the boards to share your experiences, both good and bad.
     We will be holding more of these Expert Days on different topics in the months to come.  We hope to see you then!
     If you still have questions to ask, feel free to post them on the Forum – we always have experts online to help you out.
    So, what is HP Expert Day?
    Expert Day is an online event when HP employees join our Support Forums to answer questions about your HP products. And it’s FREE.
    Ok, how do I get started?
    It’s easy. Come out to the HP Support Forums, post your question, and wait for a response! We’ll have experts online covering our Notebook boards, Desktop boards, Tablet boards, and Printer and all-in-one boards.
    We’ll also be covering the commercial products on the HP Enterprise Business Community. We’ll have experts online covering select boards on the Printing and Digital Imaging and Desktops and Workstations categories.
    What if I need more information?
    For more information and a complete schedule of previous events, check out this post on the forums.
    Is Expert Day an English-only event?
    No. This time we’ll have experts and volunteers online across the globe, answering questions on the English, Simplified Chinese, and Korean forums. Here’s the information:
    Enterprise Business Forum: January 14th 7:00am to 12:00pm and 6:00pm to 11:00pm Pacific Time
    Korean Forum: January 15th 10am to 6pm Korea Time
    Simplified Chinese Forum: January 15th 10am to 6pm China Time
    Looking forward to seeing you on January 14th!
    I am an HP employee.

    My HP, purchased in June 2012, died on Saturday.  I was working in recently installed Photoshop, walked away from my computer to answer the phone and when I came back the screen was blank.  When I turned it on, I got a Windows Error Recovery message.  The computer was locked and wouldn't let me move the arrow keys up or down and hitting f8 didn't do anything. 
    I'm not happy with HP.  Any suggestions?

  • Have questions about your Creative Cloud or Subscription Membership?

    You can find answers to several questions regarding membership to our subscription services.  Please see Membership troubleshooting | Creative Cloud - http://helpx.adobe.com/x-productkb/policy-pricing/membership-subscription-troubleshooting- creative-cloud.html for additional information.  You can find information on such topics as:
    I need help completeing my new purchase or upgrade.
    I want to change the credit card on my account.
    I have a question about my membership price or statement charges.
    I want to change my membership: upgrade, renew, or restart.
    I want to cancel my membership.
    How do I access my account information or change update notifications?

    Branching to new discussion.
    Christym16625842 you are welcome to utilize the process listed in Creative Cloud Help | Install, update, or uninstall apps to install and evaluate the applications included with a Creative Cloud Membership.  The software is fully supported on recent Mac computers.  You can find the system requirements for the Creative Cloud at System requirements | Creative Cloud.

  • Questions about using the Voice Memos app

    I'm currently an Android user, but will be getting an iPhone 6 soon. My most used app is the voice memos app on my Android phone. I have a couple questions about the iPhone's built-in voice memos app.
    -Am I able to transfer my voice memos from my Android phone to my iPhone, so my recordings from my Android app will show up in the iPhone's voice memos app?
    -When exporting voice memos from the iPhone to computer, are recordings in MP3 format? If not, what format are they in?
    -In your opinion, how is the recording quality of the voice memos app?

    You cannot import your Android voice memos to your iPhone's voice memo app.  You might be able to play the Android memos and have the iPhone pick up the audio and record it.
    Here is the writeup about sending voice memos from the iPhone to your computer (from the iPhone User Guide):
    App quality is excellent.

  • Re: Question about the Satellite P300-18Z

    Hello everyone,
    I have a couple of questions about the Satellite P300-18Z.
    What "video out" does this laptop have? (DVI, s-video or d-sub)
    Can I link the laptop up to a LCD-TV and watch movies on a resolution of 1080p? (full-HD)
    What is the warranty on this laptop?

    Hello
    According the notebook specification Satellite P300-18Z has follow interfaces:
    DVI - No DVI port available
    HDMI - HDMI-out (HDMI out port available)
    Headphone Jack - External Headphone Jack (Stereo) available
    .link - iLink (Firewire) port available
    Line in Jack - No Line in Jack port available
    Line out Jack - No Line Out Jack available
    Microphone Jack - External Micrphone Jack
    TV-out - port available (S-Video port)
    VGA - VGA (External monitor port RGB port)
    Also you can connect it to your LCD TV using HDMI cable.
    Warranty is country specific and clarifies this with your local dealer but I know that all Toshiba products have 1 year standard warranty and also 1 year international warranty. you can of course expand it.

Maybe you are looking for

  • TABLES FOR MASTER & TRANSACTIONAL DATA

    Hi all , can some body help me with TABLES FOR MASTER & TRANSACTIONAL DATA DP,SNP,PP/DP. Thanks

  • What is GL account, difference bet. Doc.date and posting date, etc.

    Hello Experts, Currently I am supporting reports/programs for FI module. Can anybody please help me or give me walkthrough on what are the terms like posting key, document date, posting date, type, account, etc. I am currently modifying a report whic

  • ABAP API - Class CL_MDM_PROVIDER_SP05_PL00 not getting

    Hi All, I am using MDM 5.5 SP05. In R/3 side , we  installed MDM_TECH 554_640  Add-On. So I can access the transaction MDMAPIC. But not getting the class CL_MDM_PROVIDER_SP05_PL00. But getting the class CL_MDM_PROVIDER_SP04_PL00. What I want to do fo

  • Mountain Lion Install Issue - Bootcam partition cant boot up!

    After installing Mountain Lion OS, I experienced startup problem with my Bootcam partition. I saw blue screen after rebooting the Mac with error message " process1_initialization_failed " after installation complete. What can I do to recover my Bootc

  • Macbook Air 2014 11inch connecting to Benq monitor

    I have just got a new macbook air 11" and plugged into my Benq E2200HD monitor with Belkin mini Display port to HDMI and blue scene on the monitor. My old Macbook uses the same cable, adaptor and monitor and works fine. Then plug into new Macbook Air