Why this does not work?

Hi all,
I got a very basic question. Why does not the constructor not_a_public() get called in the code below?
class not_public
     public static void main(String[] args)
          System.out.println("Hello World!");
          not_a_public nap = new not_a_public();
class not_a_public
void not_a_public() {
          System.out.println("Not a public!!!");
Regards
Aditya

Because that's not a constructor. Constructors can't have a return type. Remove the void and it will work. You also need to make one of the classes public.
package sandbox;
public class not_public {
    public static void main(String[] args) {
        System.out.println("Hello World!");
        not_a_public nap = new not_a_public();
class not_a_public {
    not_a_public() {
        System.out.println("Not a public!!!");
}

Similar Messages

  • Why this does not works??? (I use jsp: include. to contain two jsp files)

    I have a main.jsp, and in this main.jsp, I have two part, leftButton.jsp and view.jsp, I want to include the leftButton.jsp and view.jsp to main.jsp.
    The code of main.jsp is like follows:
    <%@ page language="java" contentType="text/html" %>
    <html>
    <head>
    <title>JSP include element test</title>
    </head>
    <body>
    <table>
    <tr>
    <td><jsp: include page="leftButton.jsp" flush="true"></jsp: include></td>
                             <td>     <jsp: include page="view.jsp" flush="true"></jsp: include></td>
                        </tr>
         </table>
    </body>
    </html>
    Why the include does not works? by the way, I embeded a flash.swf file in view.jsp.

    Hi Mellon,
    You might be better off using a JSPF segment for leftButton.jsp & view.jsp and the <%@ include file="relativeURL" %>.
    Be careful that the included file does not contain <html>, </html>, <body>, or </body> tags. Because the entire content of the included file is added to the including JSP page, these tags would conflict with the same tags in the including JSP page, causing an error.
    Note: It is conventional to put JSP segements under the WEB-INF/jspf/ folder so the file cannot be accessed directly by a URL
    Note: JSPF files end with .jspf, so your files would be leftButton.jspf and view.jspf.

  • HT1338 This does not work

    This does not work it keeps saying "Photo is already installed on this computer. Choose Software Update from the Apple menu to check for available updates." BUT it doesn't work.

    Well, is iPhoto already installed?  You never did say. 
    When you do check for updates are you getting any error messages?  Why are you stating that SU does not work? 

  • Why facetime does not working with any carrier in u.s expect att although the iphone is factory unlocked

    why facetime does not working with any carrier in u.s expect att although the iphone is factory unlocked

    Facetime only works via WiFi. Are you trying to set up Facetime with a T-Mobile account?

  • When I restart, previous tabs & websites open. I have selected open in new page in options this does not work

    When I start my computer and open Firefox, all the tabs from the previous session open. For now, I have to return each session to my home page (Google) prior to closing to prevent this from occuring. I have selected "When Firefox starts show my home page" this does not work. I have de selected and then reselected this option numerous times and it has now become a very big annoyance. I am about to uninstall Mozilla if this cant be rectified.
    Regards Tony

    Please try to troubleshoot preferences that do not save. [[How to fix preferences that won't save]]

  • Why condition does not work.

    Hi Pros,
            in my bex query, there is a CKF OT hours, having a value 30.000, when I set a condition for 'OT hours = 30.000', but get no result out. could you please tell why condition does not work.

    HI,
    please check the "Characteristic Assignment" Tab in change condition window.
    In that tab default  selection as "All Characteristic in the drill down independently" change that selection  as "Individual characteristic and Char. combinations"  and choose the particular characteristic. for ex OT hours against employee means select employee alone.
    Regards
    Sureshkumar C

  • Unsure why this is not working?

    Can anyone give me a pointer as to why this is not working? I put the code from line 16 through 50 in the "...before displaying the page" additional pl/sql section of the wizard. The form wizard created the code from 5 through 15 and 51 through 55. The first error I understand because I think the wizard forgot to end the procedure correctly by saying "end beforeModuleDisplay;" instead of just putting "end;".
    If I am right, how can I fix this since the wizard is the one putting in this info? I tried putting the correct end statement in where I put the rest of my code, but that created even more errors.
    Error creating package SOCSBO_USER.ACCT_INFO
    Error creating package SOCSBO_USER.ACCT_INFO
    Line/ColumnError
    56/5PLS-00103: Encountered the symbol "PROCEDURE" when expecting one of the following: begin declare end exception exit for goto if loop mod null pragma raise return select update while <an identifier> <a double-quoted delimited-identifier> <a bind variable> << close current delete fetch lock insert open rollback savepoint set sql execute commit forall <a single-quoted SQL string> The symbol "declare" was substituted for "PROCEDURE" to continue.
    2128/5PLS-00103: Encountered the symbol "END" when expecting one of the following: begin function package pragma procedure form
    -- PACKAGE BODY SOCSBO_USER.ACCT_INFO
    -- created Monday 05-NOV-2001 16:52
    create or replace
    1 package body ACCT_INFO as
    2 --
    3 -- Created by ASAPP using WebDB at 15:16:46, Mar 04, 2002
    4 --
    5 procedure beforeModuleDisplay
    6 (
    7 p_block_name in varchar2,
    8 p_object_name in varchar2,
    9 p_instance in integer,
    10 p_event_type in varchar2,
    11 p_user_args in varchar2,
    12 p_session in out PORTAL30.wwa_api_module_session
    13 )
    14 is
    15 begin
    16 declare
    17 l_fs varchar2(200);
    18 l_cv varchar2(200);
    19 l_sv varchar2(200);
    20 l_lang varchar2(100);
    21 l_idx integer;
    22 begin
    23 l_lang := portal30.wwctx_api.get_nls_language;
    24 l_fs := p_session.get_value_as_varchar2(
    25 p_block_name => 'DEFAULT',
    26 p_attribute_name => '_FORM_STATE');
    27 l_cv := p_session.get_shadow_value(
    28 p_block_name => 'DEFAULT',
    29 p_attribute_name => 'A_ACCOUNT_COURSE',
    30 p_language => l_lang);
    31 l_sc := p_session.get_shadow_value(
    32 p_block_name => 'DEFAULT',
    33 p_attribute_name => 'A_ACCOUNT_SUBPROJECT',
    34 p_language => l_lang);
    35 if upper(l_fs) = 'UPDATE_AND_DELETE' then
    36 l_idx := row_function.get_index('COURSE_BOTTOM');
    37 if upper(l_cv) = 'Y' then
    38 p_form.items(l_idx).visible := 'Y';
    39 else
    40 p_form.items(l_idx).visible := 'N';
    41 end if;
    42 end if;
    43 if upper(l_fs) = 'UPDATE_AND_DELETE' then
    44 l_idx := row_function.get_index('SUBPROJECT_BOTTOM');
    45 if upper(l_sv) = 'Y' then
    46 p_form.items(l_idx).visible := 'Y';
    47 else
    48 p_form.items(l_idx).visible := 'N';
    49 end if;
    50 end if;
    51 exception
    52 when others then
    53 PORTAL30.wwerr_api_error.add(PORTAL30.wwerr_api_error.DOMAIN_WWV,'app','generic','SOCSBO_USER.ACCT_INFO.beforeModuleDisplay', p1 => sqlerrm);
    54 raise;
    55 end;
    56 procedure row_function
    REST OF CODE NOT RELEVANT

    Hello Albert,
    You open a new pl/sql block on line 16, but you have only one 'end' statement.
    You can correct this by adding another 'end' statement after line 55 or you can remove the inner PL/SQL block and place it in the procedure itself. Variables can be declared after 'is' on line 14. In your example it's better to do it this way. See example.
    Hope this helps...
    Nancy.
    Example solution 2:
    -- PACKAGE BODY SOCSBO_USER.ACCT_INFO
    -- created Monday 05-NOV-2001 16:52
    create or replace
    1 package body ACCT_INFO as
    2 --
    3 -- Created by ASAPP using WebDB at 15:16:46, Mar 04, 2002
    4 --
    5 procedure beforeModuleDisplay
    6 (
    7 p_block_name in varchar2,
    8 p_object_name in varchar2,
    9 p_instance in integer,
    10 p_event_type in varchar2,
    11 p_user_args in varchar2,
    12 p_session in out PORTAL30.wwa_api_module_session
    13 )
    14 is
    15 l_fs varchar2(200);
    16 l_cv varchar2(200);
    17 l_sv varchar2(200);
    18 l_lang varchar2(100);
    19 l_idx integer;
    20
    21 begin
    22
    23 l_lang := portal30.wwctx_api.get_nls_language;
    24 l_fs := p_session.get_value_as_varchar2(
    25 p_block_name => 'DEFAULT',
    26 p_attribute_name => '_FORM_STATE');
    27 l_cv := p_session.get_shadow_value(
    28 p_block_name => 'DEFAULT',
    29 p_attribute_name => 'A_ACCOUNT_COURSE',
    30 p_language => l_lang);
    31 l_sc := p_session.get_shadow_value(
    32 p_block_name => 'DEFAULT',
    33 p_attribute_name => 'A_ACCOUNT_SUBPROJECT',
    34 p_language => l_lang);
    35 if upper(l_fs) = 'UPDATE_AND_DELETE' then
    36 l_idx := row_function.get_index('COURSE_BOTTOM');
    37 if upper(l_cv) = 'Y' then
    38 p_form.items(l_idx).visible := 'Y';
    39 else
    40 p_form.items(l_idx).visible := 'N';
    41 end if;
    42 end if;
    43 if upper(l_fs) = 'UPDATE_AND_DELETE' then
    44 l_idx := row_function.get_index('SUBPROJECT_BOTTOM');
    45 if upper(l_sv) = 'Y' then
    46 p_form.items(l_idx).visible := 'Y';
    47 else
    48 p_form.items(l_idx).visible := 'N';
    49 end if;
    50 end if;
    51 exception
    52 when others then
    53 PORTAL30.wwerr_api_error.add(PORTAL30.wwerr_api_error.DOMAIN_WWV,'app','generic','SOCSBO_USER.ACCT_INFO.beforeModuleDisplay', p1 => sqlerrm);
    54 raise;
    55 end;
    56 procedure row_function
    REST OF CODE NOT RELEVANT

  • Why RSS does not work with my OS X 10.8.2?

    Why RSS does not work with my OS X 10.8.2? There was no problem before the upgrade to the Mountain Lion.

    By clicking on the RSS icon I'm getting a message:
    "No RSS reader is installed. Safari can't open the feed because Safari can't display RSS feeds"
    In Chrome I get xml file of the RSS site.
    Should I buy something what I didn't need with the Snow Leopard?
    Thanks for your help.
    Message was edited by: PZA22

  • Domicile and billing address are Thailand. I want to buy a book in Ibooks Switzerland. However this does not work. Because my Apple ID applies to Ibooks Thai only.

    Domicile and billing address are Thailand. I want to buy a book in Ibooks Switzerland. However this does not work. Because my Apple ID applies to Ibooks Thai only.

    The best fix for your problem is to try getting your books from some other store which also has a free ereader app, such as Kindle, Nook, Kobo, GoogleBooks, Sony.

  • TS3988 Each time I log into iCloud, I check, Keep me logged in, but this does not work.  I have to reenter user name etc each time I try to go back to my iCloud account.

    Each time I log into iCloud, I check, Keep me logged in, but this does not work.  I have to reenter user name and password etc each time I try to go back to my iCloud account.

    Hi,
    In Keychain Access app in the Menu for the App is Keychain First Aid.
    If you open this is the tick box for Synchronising the Login password with the so called Login Keychain ticked ?
    9:49 pm      Monday; March 16, 2015
    ​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • Am having major issues! this does not work i dont understand..does the ipod have to be off while pressing the buttons if so how is it possible if it is connected to the computer either way it turns on..and when i tried these steps while the ipod was on it

    i am having major issues! this does not work i dont understand..does the ipod have to be off while pressing the buttons if so how is it possible if it is connected to the computer either way it turns on..and when i tried these steps while the ipod was on it still doesnt  work it just asks me “slide to power off” please someone help me i just cant seem to put my ipod in DFU mode

    To get the iPod in recovery mode and DFU mode you first have to turn the iPod off.
    Just what is the problem you are tying to resolve?
    Sometimes you have to let the battery fully drain if you can't turn the iPod off. After charging for at least hour try again.

  • I don't understand why ePrint does not work on emailing photos - Discard - Looked like a spam/ virus

    I don't understand why ePrint does not work on emailing photos - Discard - Looked like a spam/ virus

    Thanks. The problem was solved when I inserted a word in the subject line. Previously I was keeping it blank.

  • I have forgotten my answers to the questions which are asked to identify me, and I am trying to press "send instructions to my e-mail", but this does not work, what should I do?

    I have forgotten my answers to the questions which are asked to identify me, and I am trying to press "send instructions to my e-mail", but this does not work, what should I do?

    If the email hasn't arrived after a few hours and isn't in a spam filter, you need to ask Apple to reset your security questions. To do this, click here and pick a method; if that page doesn't list one for your country or you're unable to call, fill out and submit this form.
    (113969)

  • My iCloud email does not work. Getting error message that i need to uncheck SSL . This does not work. Help

    icloud Email does not work. When running Connection doctor it indicates I must check or uncheck SSL. This has not fixed the problem

    iCloud email addresses (@mac.com, @me.com and @icloud.com) require SSL. Is your address an iCloud address or someone else?

  • Want to open Kodak Photo CD files (.PCD) in Photoshop CS5.  In CS4 i copied file "Photo CD.8BI"  from an older version into the File Format folder.  This does not work with CS5.  Any fix?

    I have several old Kodak Photo CD with PCD image files.  I am now using Photoshop CS5.  Some years ago while using Photoshop CS4 I copied a file:  "Photo CD.8BI" from an older, CS2, version to the Plug-ins/File Format folder of CS4.  This does not appear to work with CS5.  Any fix?

    It can be made to work, but you have to run the 32 bit version of Photoshop CS5, and as I recall there's an additional DLL called pcdlib32.dll that's needed from the old installation.
    See also:  Open Kodak PhotoCD files in PS CS5 - is it possible? (Win XP)
    -Noel

Maybe you are looking for

  • HP Laser Printer Problems

    I recently bought an HP CLJ 2025 printer and was disappointed to not find the option where we can choose the type of paper we're printing on. When HP did the demo for me, they used a PC laptop so they had no problem...but when I installed it in my Ma

  • Database crawler won't doc open problem

    I am using the database record viewer and have crawled in some databases but when I try to apply a stylesheet to them and you click on the file it does not open in the browser it wants to save the file. If you do save it then open it the file display

  • Reg archiving to the SAP DMS server

    Hi All I have a requirement, I am building an RFC for the PORTAL backend. Currently the front end is generating the PDF for the vendor master. They will be sending the PDF as an XSTRING fromate to my BACKEND RFC. Then i need to convert this XSTRING t

  • Opening a Folder

    Hi: Im trying to get a projector to open a folder that is located next to the projector on the CD. This folder contains other files and folders that I need the user to explore. I've read some of the topics, but im still a little confused on how to ac

  • Send to Color results in single still frame

    When I send to color, some of the clips only display a still frame of that clip. The clip in the color timeline is of the correct duration, but it simply repeats that single frame. This happens even if I export the XML from Final Cut and import it in