No public constructor, why?

The Pattern and Matcher classes in in java.uti.regex package do not have public constructors. Instead, an object for those classes can be retrieved by invoking their static methods, Pattern.compile() and Matcher.matcher() respectively.
What is the reason? Why do they not have public constructor?
It is not clearly an implementation of Singleton Pattern which is characterized by getInstance() method.
Thanks in advance

sosododo wrote:
The Pattern and Matcher classes in in java.uti.regex package do not have public constructors. Instead, an object for those classes can be retrieved by invoking their static methods, Pattern.compile() and Matcher.matcher() respectively.
What is the reason? Why do they not have public constructor?
It is not clearly an implementation of Singleton Pattern which is characterized by getInstance() method.
Thanks in advancePlease be aware that the singleton pattern is not characterized by a getInstance method (which is in fact a factory method) and nor is the presence of a method called getInstance any indicator of a singleton. Here is a perfectly valid (and more thread-safe) implementation of the singleton pattern
public class ASingleton {
public static final ASingleton INSTANCE = new ASingleton();
  private ASingleton() {}
}Not a getInstance in sight

Similar Messages

  • Default class with public constructor - why?

    Noticed some code that had a class with package-level access and a public constructor - wondered what the benefit/use of that would be... Thanks!

    GarudaJava wrote:
    Noticed some code that had a class with package-level access and a public constructor - wondered what the benefit/use of that would be... Thanks!If the class itself doesn't need to be exposed, but it implements some interface, and is assumed to have a public no-arg consturctor, it could be created reflexively. This is a contrived situation, but it's the only one I can think of in Java where that'd be useful.
    package foo;
    class Foo implements SomeInterface {
      public Foo() {
    package factory;
    class Factory {
      public static SomeInterface create(Class<? extends SomeInterface> clazz) { // not sure if I got the generics right, but they're incidendtal to the example
        return clazz.newInstance();
    package foo;
    import factory.Factory;
    public class Bar {
      public void bar() {
        SomeInterface si = Factory.create(Foo.class);
        si.doStuff();
    }Like I said, pretty contrived, and I can't think of a real-world use case that matches it offhand, but structurally it'd look something like that.
    You could also maybe imagine that the factory package might do more than just create and return an instance. It might create it and use that SomeInterface type for its own ends.

  • Public Constructor in atg

    Hi ,
    i was going through the doc Public Constructor , why constructor without args is needed in creating a nucleus component. i create a component like
    Test.java
    name;
    getxx();
    setxx();
    Test.properties
    name=Kavi
    when i went to dyn/admin im able to see the value 'Kavi' under name property in Test Component,then what is the need of a default constructor.Please add your inputs
    Regards
    G.KaviMani

    Hi Joe,
    Oracle ATG Web Commerce - Public Constructor with No Arguments
    Public Constructor with No Arguments
    Nucleus can create a component automatically from a properties file if the component class is declared public and it implements a public constructor with no arguments. For example:
    public class Person {
      public Person () {}
    The constructor is not required to be empty. However, as shown later in this chapter, it is often a good idea to defer initialization functions until after the component starts.
    If the constructor for the component class requires arguments, you will need to supply additional information. See Parameterized Constructors.
    So this means the above highlighted statement is not mandatory correct ?? Pls correct me if am wrong.
    Regards
    G.KaviMani

  • Public constructor problem

    I am getting the following error
    The applet orderproc.NewUser does not have a public constructor orderproc.NewUser()
    I dont understand this as the rest of my applets have similar code but dont get this problem. Can any of you nice people out there help. Here is my code:
    package orderproc;
    import java.lang.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.ResultSet;
    import java.net.URL;
    import java.sql.*;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2003</p>
    * <p>Company: </p>
    * @author unascribed
    * @version 1.0
    public class NewUser extends JApplet implements ActionListener {
    JPanel westPanel;
    JPanel eastPanel;
    JLabel lblFirstName, lblLastName, lblPassword, lblUserName;
    JTextField txtFirstName,txtLastName,txtUserName, txtPassword;
    JButton btnSubmit, btnBack, btnCancel;
    String FN,LN,PS,UID;
    public NewUser()
    GridBagLayout gbl;
    GridBagConstraints gbc;
    gbl = new GridBagLayout();
    gbc = new GridBagConstraints();
    westPanel = new JPanel();
    westPanel.setLayout(gbl);
    eastPanel = new JPanel();
    eastPanel.setLayout(gbl);
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(westPanel, BorderLayout.CENTER);
    getContentPane().add(eastPanel, BorderLayout.SOUTH);
    lblFirstName = new JLabel("First Name: ");
    lblLastName = new JLabel("Last Name: ");
    lblPassword = new JLabel("Password: ");
    lblPassword = new JLabel("User Name: ");
    txtFirstName = new JTextField(15);
    txtPassword = new JTextField(15);
    txtLastName = new JTextField(15);
    txtUserName = new JTextField(15);
    btnSubmit = new JButton("Submit");
    btnSubmit.addActionListener(this);
    eastPanel.add(btnSubmit);
    btnCancel = new JButton("Cancel");
    btnCancel.addActionListener(this);
    eastPanel.add(btnCancel);
    btnBack = new JButton("<<<<Back");
    btnBack.addActionListener(this);
    eastPanel.add(btnBack);
    gbc.anchor = GridBagConstraints.NORTH; // Align labels
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbl.setConstraints(lblFirstName, gbc);
    westPanel.add(lblFirstName);
    gbc.gridx = 1;
    gbc.gridy = 2;
    gbl.setConstraints(lblLastName, gbc);
    westPanel.add(lblLastName);
    gbc.gridx = 1;
    gbc.gridy = 3;
    gbl.setConstraints(lblPassword, gbc);
    westPanel.add(lblPassword);
    gbc.gridx = 1;
    gbc.gridy = 4;
    gbl.setConstraints(lblUserName, gbc);
    westPanel.add(lblUserName);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 2;
    gbc.gridy = 1;
    gbl.setConstraints(txtFirstName, gbc);
    txtFirstName.setEditable(true);
    westPanel.add(txtFirstName);
    gbc.gridx = 2;
    gbc.gridy = 2;
    gbl.setConstraints(txtLastName, gbc);
    txtPassword.setEditable(true);
    westPanel.add(txtLastName);
    gbc.gridx = 2;
    gbc.gridy = 3;
    gbl.setConstraints(txtPassword, gbc);
    txtPassword.setEditable(true);
    westPanel.add(txtPassword);
    gbc.gridx = 2;
    gbc.gridy = 4;
    gbl.setConstraints(txtUserName, gbc);
    txtUserName.setEditable(true);
    westPanel.add(txtUserName);
    public void actionPerformed(ActionEvent ae) // Action event handling
    if(ae.getSource() == btnBack)
    setVisible(false);
    else if(ae.getSource() == btnCancel)
    txtFirstName.setText(null);
    txtPassword.setText(null);
    txtLastName.setText(null);
    txtUserName.setText(null);
    else if(ae.getSource() == btnSubmit)
    FN = txtFirstName.getText();
    LN = txtLastName.getText();
    PS = txtPassword.getText();
    UID = txtUserName.getText();
    try
    //connect to database
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    System.out.println("Drivers loaded");
    String url = "jdbc:odbc:wms";
    Connection con = DriverManager.getConnection(url,"root","");
    System.out.println("Connection established");
    Statement stmt = con.createStatement();
    System.out.println("Statement created");
    ResultSet res = stmt.executeQuery("INSERT INTO login (FirstName, LastName, Password, UserName) VALUES ('"+FN+"','"+LN+"', '"+PS+"','"+UID+"')");
    con.close();
    catch(Exception e)
    txtFirstName.setText(null);
    txtLastName.setText(null);
    txtPassword.setText(null);
    txtUserName.setText(null);
    public void init()
    NewUser myNewUser = new NewUser();

    Why don't you just implement the RSAPrivateKey and RSAPublicKey interfaces?

  • ERROR:The applet Tennisball does not have a public constructor Tennisball()

    hi all...sorry...i encountered this java error msg with the following code.....n the error msg tat was generated is that i do not have a public constructor which i already have...can some1 please enlighten me..??
    import java.applet.*;
    import java.awt.*;
    public class Tennisball
         double x, y, oldx, oldy, xinc, yinc, v=2.0;
         int i,e,west,north,east,south,ry,rs,score,rx;
         int choice, zone;
         AudioClip ballout;
         boolean running,toggle,enough;
            Color ballcolor;
         Tennis t;
         Color bgColor = Color.black;
         public Tennisball(int w, int n, int e, int s, AudioClip bo)
                    west=w;
              east=e;
              south=s;
              north=n;
              ballout = bo;
              //this.t = t;
              xinc=1.7*v;
              yinc=0.7*v;
         public void getRacketPosition(int racket_y)
              ry=racket_y;
              rs=ry;
         public void newBall()
              ballcolor=Color.yellow;
              x=20;
              y=(int)(Math.random()*100+50);
              int angle=(int)(Math.random()*8+1);
              if(angle==1)yinc=-0.7*v;
              if(angle==2)yinc=-0.5*v;
              if(angle==3)yinc=-0.4*v;
              if(angle==4)yinc=-0.3*v;
              if(angle==5)yinc=0.3*v;
              if(angle==6)yinc=0.4*v;
              if(angle==7)yinc=0.5*v;
              if(angle==8)yinc=0.7*v;
              toggle=false;
              running=true;
              enough=false;
              e=0;
         public void move()
              if(running)
                   if(!toggle)
                        oldx=x;
                        oldy=y;
                        x+=xinc*v;
                        y+=yinc*v;
                   if(x<west && xinc<0)
                        int angle=(int)(Math.random()*8+1);
                        if(angle==1)yinc=-0.7*v;
                        if(angle==2)yinc=-0.5*v;
                        if(angle==3)yinc=-0.4*v;
                        if(angle==4)yinc=-0.3*v;
                        if(angle==5)yinc=0.3*v;
                        if(angle==6)yinc=0.4*v;
                        if(angle==7)yinc=0.5*v;
                        if(angle==8)yinc=0.7*v;
                       xinc=-xinc;
                        t.playClick();
                   else if(x>east-10)
                        x=east-10;
                        toggle=true;
                        running=false;
                        score++;
                        t.playBallout();
                   else if(y<north || y>south)
                       if(y<north&&yinc<0)
                             yinc=-yinc;
                        if(y>south&&yinc>0)
                             yinc=-yinc;
                        t.playClick();
                   else if(x>425 && xinc>0 && y>ry && y<rs+25)
                        if(y<ry+3)zone=1;
                        else if(y>=ry+3&&y<ry+6)zone=2;
                        else if(y>=ry+6&&y<ry+9)zone=3;
                        else if(y>=ry+9&&y<ry+12)zone=4;
                        else if(y>=ry+12&&y<ry+15)zone=5;
                        else if(y>=ry+15&&y<ry+18)zone=6;
                        else if(y>=ry+18&&y<ry+21)zone=7;
                        else if(y>=ry+21)zone=8;
                        if(zone==1)yinc=-0.7*v;
                        if(zone==2)yinc=-0.5*v;
                        if(zone==3)yinc=-0.4*v;
                        if(zone==4)yinc=-0.3*v;
                        if(zone==5)yinc=0.3*v;
                        if(zone==6)yinc=0.4*v;
                        if(zone==7)yinc=0.5*v;
                        if(zone==8)yinc=0.7*v;
                        xinc=-xinc;
                        t.playClick();
         public void toggle()
                        int i=t.j;
                        if(!enough)
                             if(i>-1&&i<11)ballcolor=Color.yellow;
                             if(i>10&&i<20){ballcolor=bgColor;e++;}
                        if (e>35){ballcolor=bgColor;enough=true;}
         public void paint(Graphics g)
              if(toggle)toggle();
              g.setColor(ballcolor);
              g.fillOval((int)x,(int)y,10,10);
    }

    I thought I should point out a few things
    The rule is that every class should have a no
    argument constructor that you need to specify
    explicitly if you have overloaded the default one.
    One of the reaons for that is the following:This is not true, there are many classes that do not have a no argument constructor (For example Integer). Integer is a perfect example of why you would not want a no argument constructor, having an Integer with no value is pointless (theres nothing you can do with it).
    public class A {
    private final int a ;
    public A(int b) {
    this.a = b ;
    }Now you realize that the variable
    n
    is getting initialized in the constructor. I see no variable n in the constructor but I take it you mean a
    Now if you
    refer to
    n
    somewhere else in you code you get a compile error because
    n
    might not have been initialized.This is not true, only local variables can cause a
    variable (a variable) might not have been initialized
    this is because all member fields are initialised with their default valuse. For example all pointers are intitialised to null, ints are intitialised to 0, booleans to false and so on.
    >
    So you need this:
    public class A {
    private final int a ;
    public A(int b) {
    this.a = b ;
    public A() {
    this(0) ; /* Calls the above constructor with some
    default parameter. */
    /* You can add some more code below but not above
    this(0) */
    Of course you know you are never calling the default
    constructor but it's still there so you need to
    ensure that the variables get initialized if some one
    calls it!
    As above classes can have no argument constructors
    Just add this to your code for example:
    public Tennisball() {
    this(0, 0, 0, 0, null) ;
    } Hope that helped you out!
    Thanks,
    Nikolas.
    PS any duke dollars would be much appreciated as i'm
    very poor at the moment :-)I dont mean to be offensive just thought I should clarify these points
    Michael

  • Applet - JavaPurse does not have a public constructor

    Hello,
    I'm starting playing with Javacard and I tried to compile a demo of Java purse Applet.
    I can compile it withou problem but once I try to start it with JBuilder 2006 I get the following error :
    The applet com.sun.javacard.samples.JavaPurse.JavaPurse does not have a public constructor com.sun.javacard.samples.JavaPurse.JavaPurse()
    Here is a part of my code
    public class JavaPurse extends javacard.framework.Applet {
    protected JavaPurse(byte[] bArray, short bOffset, byte bLength) {
    public static void install(byte[] bArray, short bOffset, byte bLength) {
    new JavaPurse(bArray, bOffset, bLength);
    Does anyone of you know why JBuilder is displaying this error message?
    Thanks in advance fo you reply.
    Alain.

    I don't think that's the error message; there is no class "java.awt.Applet". Are you sure it doesn't say "java.applet.Applet"?
    In any event, I don't know about javacard, but I suspect that javacard applets are not interchangeable with browser applets. My guess is that when JBuilder tries to build an applet, it's thinking about browser applets. Therefore it expects your applet to be a subclass of java.applet.Applet.
    I don't know how JBuilder works, but perhaps you can try using normal compilation instead of whatever JBuilder provides for applets.

  • GetCodeBase() generates "does not have a public constructor"

    I've been searching the net for days, and I seem to be the only guy with this problem. Here's the simple code:
    public class testapplet extends JApplet {
    public testapplet() {
    URL url = getCodeBase();
    I get the error message:
    The applet testapplet does not have a public constructor testapplet()
    I once had the same error message, but it was an entirely different problem. At that time, I made an JMenu[2] and somewhere in the code addressed JMenu[3];
    As I said, this has nothing to do with my current problem, but I get VERY frustrated when I get such an error.
    I'm running JBuilder6 on Win XP. Please help! desperate cry

    Damn, it helped. O_O Thanks a lot! As you can tell, I'm new to this. I was surprised since in my other program, I wrote a lot of stuff without that init procedure and it worked...
    Thanks again!

  • The applet FtpExample does not have a public constructor FtpExample()

    Hi
    Get this from my Jbuilder, but I got an constructor. What's the problem ?
    import ftp.*;
    import java.io.*;
    import java.applet.*;
    class FtpExample implements FtpObserver, Runnable
    Thread thread;
    FtpBean ftp;
    long num_of_bytes = 0;
    public FtpExample()
    // Create a new FtpBean object.
    ftp = new FtpBean();
    try {
    jbInit();
    } catch (Exception ex) {
    ex.printStackTrace();
    // Connect to a ftp server.
    public void connect()
    try
    ftp.ftpConnect("xxxxxxxxxxxx", "xxxxxxx", "xxxxxxx");
    } catch(Exception e)
    System.out.println(e);
    and more...
    .

    I thought I should point out a few things
    The rule is that every class should have a no
    argument constructor that you need to specify
    explicitly if you have overloaded the default one.
    One of the reaons for that is the following:This is not true, there are many classes that do not have a no argument constructor (For example Integer). Integer is a perfect example of why you would not want a no argument constructor, having an Integer with no value is pointless (theres nothing you can do with it).
    public class A {
    private final int a ;
    public A(int b) {
    this.a = b ;
    }Now you realize that the variable
    n
    is getting initialized in the constructor. I see no variable n in the constructor but I take it you mean a
    Now if you
    refer to
    n
    somewhere else in you code you get a compile error because
    n
    might not have been initialized.This is not true, only local variables can cause a
    variable (a variable) might not have been initialized
    this is because all member fields are initialised with their default valuse. For example all pointers are intitialised to null, ints are intitialised to 0, booleans to false and so on.
    >
    So you need this:
    public class A {
    private final int a ;
    public A(int b) {
    this.a = b ;
    public A() {
    this(0) ; /* Calls the above constructor with some
    default parameter. */
    /* You can add some more code below but not above
    this(0) */
    Of course you know you are never calling the default
    constructor but it's still there so you need to
    ensure that the variables get initialized if some one
    calls it!
    As above classes can have no argument constructors
    Just add this to your code for example:
    public Tennisball() {
    this(0, 0, 0, 0, null) ;
    } Hope that helped you out!
    Thanks,
    Nikolas.
    PS any duke dollars would be much appreciated as i'm
    very poor at the moment :-)I dont mean to be offensive just thought I should clarify these points
    Michael

  • Only one public class - why???

    Hi
    I have come across this statement many places -
    "There can be only one Top-Level 'public' class in
    a java source file which should have same name as that
    of the fore mentioned class."
    I know that the compiler searches for the class
    with same name as that of the file that is passed to
    the compiler.I am also aware that a Java source compiles
    smoothly with One or None Top-Level 'public' class,
    but I fail to comprehend this -
    Why can there be only one TOP-LEVEL 'public' class
    in a Java Source file?
    The importance of 'TOP-LEVEL' is as important as
    any thing else, as you yourself check that a Nested
    class within an Enclosing class can be 'public' along
    with someother Top-Level 'public' class in the program
    compiles smoothly unlike having TWO Top-Level 'public'
    classes in same file.
    I have found no reason supporting this statement in any
    of the refernces I have checked out.Ppl I have asked told
    me that it is so coz Java Spec say so.
    Is there an better answer to my question?
    Thanx in advance, appretiate it.
    Regards
    Pradeepto

    I have found no reason supporting this statement in
    in any
    of the refernces I have checked out.Ppl I have asked
    told
    me that it is so coz Java Spec say so.I can tell you that anybody who says its because the Java spec says so, is wrong - the Java spec does not say so.
    It is a limitation of Sun's javac compiler, which many other compilers exhibit as well. I don't know the full formal reasoning behind it (and would be interested in knowing if you find a good answer), but I assume it simply has to do with finding classes without having to load everything on your classpath.
    Whether other compilers are purposely acting the same way as javac, or whether it is some sort of performance optimisation that most vendors feel is worthwhile, I couldn't say.
    I don't see what you're saying about top-level and nested classes. Although you can declare a public nested class inside a non-public top-level class, the nested class is not actually publicly visible, by virue of its enclosing class not being publicly visible.

  • Timemachine tries using Public-1 why ???

    I am trying to use Timemachine on a non Apple NAS.
    The latter publishes a /Volumes/Public folder via Samba on which I can happily create files in a Terminal window:
    //GUEST:@RJATS219P(SAMBA)._smb._tcp.local/Public 3842633248 1027606704 2815026544    27%    /Volumes/Public
    imac:Public Bob$ ls -la
    total 46
    drwxrwxrwx  1 Bob   staff  16384  5 Nov 10:45 .
    drwxrwxrwt@ 5 root  admin    170  5 Nov 10:41 ..
    -rwxrwxrwx  1 Bob   staff   6148 28 Ott 23:18 .DS_Store
    -rwxrwxrwx  1 Bob   staff      0  5 Nov 10:45 testfile
    I see this share in the Time machine preferences and selected it.
    When the backup starts it hangs on a "Making file available" for a while (out of memory so message could be slightly different) but then after a few mins fails with the following message:
    Time Machine could not complete the backup
    The backup disk image "/Volumes/Public-1/Imac.sparsebundle" could not be created (error 45).
    Why is TM trying to use a non existant Public-1 filesystem ?
    Thank you very much.
    Bob

    Sorry think I solved it by myself :-)
    a) I think one problem was trying to use a SMB share. Is that correct ?
    b) The problem was solved by performing a "Full reset of Time Machine" as described here:
    http://web.me.com/pondini/Time_Machine/A4.html
    Thank you all
    Bob

  • Why aren't inherited constructors returned?

    Let's say I have an abstract class that defines a public constructor, and a different class that extends this abstract class. I'd like to use reflection to instantiate an object of the subclass using the constructor of the parent class. If this is possible to do in code, why is it not possible to do at run-time? (Or am I hopefully missing something, and there is in fact a way to do this?) If Class.getMethods() will return inherited methods, why won't Class.getConstructors() return inherited constructors?

    Let's say I have an abstract class that defines a
    public constructor, and a different class that extends
    this abstract class. I'd like to use reflection to
    instantiate an object of the subclass using the
    constructor of the parent class. If this is possible
    to do in code, It's not possible to do it "in code" (by which I assume you mean the "normal" way, without reflection). As the other poster said, constructors are not inherited.
    If you're specifically interested in reflection, the following may not be particularly applicable to your current problem. However, you'll need to understand these rules anyway...
    Here are the rules for constructors--"ctors" because I'm lazy. Also, because I'm lazy, "super(...)" and "this(...)" mean any super or this call, regardless of how many args it takes, including those that take no args.
    1) Every class has at least one ctor.
    1.1) If you do not define an explicit constructor for your class, the compiler provides a implicit constructor that takes no args and simply calls super().
    1.2) If you do define one or more explicit constructors, regardless of whether they take args, then the compiler no longer provides the implicit no-arg ctor. In this case, you must explicitly define a public MyClass() {...} if you want one.
    1.3) Constructors are not inherited.
    2) The first statement in the body of any ctor is either a call to a superclass ctor super(...) or a call to another ctor of this class this(...) 2.1) If you do not explicitly put a call to super(...) or this(...) as the first statement in a ctor that you define, then the compiler implicitly inserts a call to super's no-arg ctor super() as the first call. The implicitly called ctor is always super's no-arg ctor, regardless of whether the currently running ctor takes args.
    2.2) There is always exactly one call to either super(...) or this(...) in each constructor, and it is always the first call. You can't put in more than one, and if you put one in, the compiler's implicitly provided one is removed.

  • Why do we need public classes?

    I read that a public class is more visible than a default (non-public) class as the latter is merely "package-visible". However, it appears that even if a class (c in package p) is not declared to be public, it can still be accessed by:
    1) p.c
    2) import p.c
    So what is the use of declaring a class to be public? Why can't we just write:
    class c {...}
    every time for every class without the modifier public.
    Can someone show me an example that illustrates the difference between a public class and a default class?

    I read that a public class is more visible than a
    default (non-public) class as the latter is merely
    "package-visible". However, it appears that even if a
    class (c in package p) is not declared to be public,
    it can still be accessed by:
    1) p.c
    2) import p.c
    How does that appear so?
    Trying to do it the compiler says that "p.c is not public in p; cannot be accessed from outside package" and does not generate a class file.

  • Why ..we have to use this ? public static void ? please !

    hi ...im ibrahim ..and im new here in java nd new in the forum too ...nd please i would like to know ...why
    do we use the method
    public static void main (String []args)
    i mean why ..static nd why public ..why void ....why main ..nd why (string []args)
    ...why we use it ...always ....hopefully ..im looking for a very clear answer to this ...issue ..?
    please help .......!

    public - this is the visibility modifier (it means that the body method can be call by any outside method)
    static - the method is a static instance of the class. Not sure what exactly it does though.
    void - this is the return type. void means that the method returns nothing.
    main - the name of the method. It can be anything.
    "public static void main" - this is the main method where upon executing the Java program the Java Virtual Machine will try to locate this method within the specifies class to be executed. This is always the first one to run when executing a Java program. None of this word may be changed or the program cannot be run.

  • ClientMethods in Interface of ApplicationModule are not public - why?

    Hi
    I realized (with some surprise) that all declared client methods in the interface of an application module are not public. Why? Is there a specific reason or is this a bug?
    Example:
    - Create a simple ApplicationModule "MyApplicationModule" (not remotable)
    - Write a simple method "public void myMethod()" in MyApplicationModuleImpl
    - Use the ApplicationModule-Wizard Tab "Client Interface" to shift "myMethod()" to the client In side
    => JDeveloper generates several Files, one of these is "MyApplicationModule.java".
    => in MyApplicationModule.java method "myMethod" is defined but without the "public" modifier.
    I guess this is a bug.
    Thanks for your help

    Yes, you are right.
    I just stumbled over this fact (which I didn't realize yet. <blush/>) because the methods were flagged as "not accessible" in the editor. They became "accessible" as soon as I added the "public" modifier to the method definition in the interface.
    But now, after I restarted JDeveloper the editor does not flag the methods anymore even without the "public" modifier.
    Seems as if the Editor sometimes forgets this rule too ;-)
    Thanks for your help

  • Class with no constructors

    The class javax.microedition.rms .RecordStore does not have a constructor. Why?
    Please note that I am not asking how to produce an instance of a RecordStore, I have read the documentation and am aware of the static openRecordStore method.
    Paul Hide

    javax.microedition.rms.RecordStore has no public or protected constructor so you can't extend it.
    If a private constructor is defined in a class then it is not exposed in documentation (usually), but at the other hand if you have not defined any constructor then non-argument public constructor is shown in the documentation.
    So it seems that javax.microedition.rms.RecordStore has private constructor.
    So you can't extend it.
    Following two type of classes are non-extendable:
    - Whose all constructors are made private. E.g. java.lang.Runtime, java.lang.System.
    - Final class (just final keyworkd is added in access specifiers). E.g. java.lang.String
    Following two type of classes are non-instantiable:
    - Whose all constructors are made private. These can be instantiated inside the class. E.g. java.lang.Runtime, java.lang.System
    - Abstract class (just abstract keyword is added in access specifiers). E.g. java.io.OutputStream
    Regards,
    Humayun.

Maybe you are looking for

  • ICal cuts off text of some events in month view

    I've noticed that iCal cuts off the text of some events, while displaying the full text of longer events in the month view. For example, if I create an event titled "Test Event" only "Test" shows up in the day it's created, but if I enter "Longer Eve

  • Importing BAPI's in Visual Composer

    hi we have installed EP 6.0 SP2 Patch 4 on which we have installed Visual Composer 6.0. we are able to successfully launch VC and also connect to the portal. using user mapping we can also connect to R/3  and browse and see the list of available BAPI

  • EHP1 installation for PI 7.1

    Dear all, we are trying to install the EHP1 in win server with PI 7.1 db2. After downloading and extracting the SAP EHP installer, when executing the "STARTUP.BAT "jce_policy_zip=<policy zip archive>"" the system returns : cannot determine SAP direct

  • GTalk from behind the firewall using Python

    Friends, I'm a student accessing the net from behind the University Firewall and it does not allow us access to GTalk (some crappy policy). When I was using Windows, about a couple of months back, I used to run Python server and to tunnel thru it to

  • The trash icon is missing from the sidebar in iPhoto.

    In my sidebar when on iphoto I often used the trash icon there to delete photos quickly. All of a sudden I notice it is no longer there. How do I put it back please? Thanks.