Why startApp() in J2ME is not static

Hi,
I was wondering why startApp() in J2ME is not static but main() in Java is static. Please
tell me why is it so when both are being called by JVM.

Well the init () method of Applet is also not static, for the same reason .. the applet launcher of the browser creates an instance of the class when its loaded via HTML.
For regular j2se classes other than Applet / JApplet, the jvm does not automatically create an instance of the class, and that's why main (...) has to be static. As to why this should be so, I think it's just a matter of design.
Research the jls (Java Language Specification) if you're really interested, there may be a logical reason for adopting this design philosophy.
{color:#0000ff}http://java.sun.com/docs/books/jls/{color}
db
p.s. If you find something really interesting, do share it here :-)

Similar Messages

  • Why C# is not statically typed but F# and Haskell are?

    There was a talk given by Brian Hurt about advantages and disadvantages of static typing.
    Brian said that by static typing he don't mean C#, but F# and Haskell.
    Is it because of dynamic keyword added
    to C#-4.0? But this feature is relatively rarely useful. By the way, there are ⊥ and unsafeCoerse in
    Haskell which obviously are not the same, but something that could blown your head off in runtime similarly like exception thrown as a result of dynamic.
    Finally, why F# and Haskell could be named a statically typed languages and C# couldn't?

    I'm addressing the overlap between Haskell and F#'s type systems. The part they share is known sometimes as System F. F# by necessity provides bits and pieces of C#'s type system, but this isn't what the speaker was talking about.
    Both C# and Haskell/F# are statically typed, but they're two different flavors.
    Subtyping
    Specifically, C# is a statically typed language with subtyping. This means that if you look at the typing rules for C# there's one like
    Env |- x : T, T' <: T
    Env |- x : T'
    Which means that any well typed term has more than one potential type. This in not the case in (vanilla) Haskell or F#. Every type has a single most general type, a principal type. This has a few benefits like total type inference.
    Expressions Everywhere
    Besides this, Haskell and F# have a greater emphasis on expressions, expressions have types, but statements don't. This means that in C#, the compiler is checking less of your code, because less of your code has types. In Haskell, everything has a real, checkable
    type.
    In substantive terms, every single node on a Haskell AST has a type or kind (or sort). The same cannot be said of a C# one.
    Sum Types
    Beyond this, Haskell and F# have what are known as sum types.
    data Bool = True | False
    This is how a boolean is defined in Haskell. This provides a few different guarantees than in C#. For example, when there are a discrete number of things in C#, like say, an AST. We can model this with an inheritance hierarchy, but these are open. Anyone can
    come along and add something to it. We can use an Enum,
    but then there's no sane way to attach data to each tag uniformly. This is what's called a tagged union, and it's up to you to implement/use it correctly, the compiler ain't gonna help.
    This makes it very hard to ensure that we've covered all possible nodes of an AST. For example, say you have a function
    doStuff :: AST -> AST
    doStuff (SomeExpr ..) = ...
    doStuff (SomeStatement ..) = ...
    --// doStuff (SomeIf ...) = Oh noes, we forgot a node
    The compiler can warn you because it can prove exactly how many nodes there are, ever. In C#, the equivalent would have to be done with downcasting, and then, since the set of nodes in our hierarchy is open, there's no way to issue compile time warnings.
    A company, Jane Street, raves about how useful this feature is in their large OCaml code base. Watch a few of their talks,
    they talk quite a bit about how using OCaml impacts them in the Real World.
    Soapbox
    Now I've outlined quite a few differences over System F over many mainstream type systems, but they're all still static type systems. It does bother me when people call Java/C#/C++ "not statically typed" they are. And they certainly give you
    more compile time guarantees than say, Python. So it's a bit unfair to dismiss them out right.

  • Why JTextArea.select(int,int) not Highlight in java 1.4

    Hi guys
    Does anybody know why JTextArea.select(int, int) not Highlight the selected text in java 1.4. But java 1.3 works. Does java 1.4 change to use other method to hightlight the selected text in JTextArea? Thanks in advance.
    Regards,
    Mark.

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class SelTest extends JPanel {
      private JTextArea area;
      public SelTest() {
        setLayout( new BorderLayout() );
        area = new JTextArea( "This is a sample text", 20, 20 );
        JButton btn = new JButton( "Select" );
        btn.addActionListener( new ActionListener(){
          public void actionPerformed( ActionEvent ae ){
            selectText2();
        add( area, BorderLayout.CENTER );
        add( btn, BorderLayout.SOUTH );
      private void selectText2(){
        area.requestFocus(); // MOST IMPORTANT
        area.select( 1, 4 );
        System.out.println("selcted : " + area.getSelectedText() );
      public static void main(String[] args) {
        JFrame f = new JFrame();
        f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        f.getContentPane().add( new SelTest() );
        f.pack();
        f.setVisible( true );
    }

  • Why mails in iphone are not synchronize with my macbook? how can i make them synchronize?,

    Why mails in iphone are not synchronize with my macbook? how can i make them synchronize? I am a new user of apple product just then i had realized these problem, please somebody help me. Thank you in advance!

    Gmail can be setup as IMAP, however you have to set such up on all your devices:
    http://support.google.com/mail/bin/static.py?hl=en&ts=1668960&page=ts.cs

  • Why in SE16 we can not  see New Data Table for standard DSO

    Hi,
    We says that there is three tables (New Data Table, Active Data Table and Change Log Table) of Standard DSO, Then Why in SE16 we can not  see New Data Table of Standard DSO.
    Regards,
    Sushant

    Hi Sushant,
    It is possible to see the 3 DSO tables data in through SE16. May be you do not have authorization to see data through SE16.
    Sankar Kumar

  • Why the default value is not the Oracle recommended?

    Why the default value is not the Oracle recommended?
    In Oracle 10g, the default alocated unit of Oracle ASM is 1MB. But the Oracle ducumentation states that "To ensure a higher probability of one
    logical I/O resulting in no more than one physical I/O, the minimum stripe depth should be at least twice the Oracle block size". ---See Performance Tuniing Guide (10g10.2 Page8-3.
    It's inconsistent. What is right way?

    >
    Why the default value is not the Oracle recommended?
    In Oracle 10g, the default alocated unit of Oracle ASM is 1MB. But the Oracle ducumentation states that "To ensure a higher probability of one
    logical I/O resulting in no more than one physical I/O, the minimum stripe depth should be at least twice the Oracle block size". ---See Performance Tuniing Guide (10g10.2 Page8-3.
    It's inconsistent. What is right way?
    The default database blocksize of 10g is 8k.
    >
    8 * 128 = 1024
    128 >= 2
    At least twice the size does not mean exactly the doubled size.
    There is no contradiction between the documentation and your observation in this case.
    Kind regards
    Uwe
    http://uhesse.wordpress.com

  • Has anyone been able to contact Adobe to learn why their Flash Player does not work on Mac OS 10.6.8, no matter how many updates you install?  This seems like a big error by Adobe.

    I have thee Mac computers with Mac OS 10.6.8, one of which is a Mac Pro.  No matter how many updates I install from Adobe, their Flash Player does not work on any of these 3 computers.  I don't know how to contact Adobe Systems about this problem, but I think it is their responsibility to make sure that their so-called "universal" software works proplerly on a relatively recent operating system like OS 10.6.8 that is still in widespread use.  When you install the updates, nothing happens -- not even an error message.  What is the point of a universal player that is not universal?  It works fine on my MacBook Pro with OS 9 Mavericks, but it does not work at all -- indeed, has never worked -- on my 3 Macs with OS 10.6.8.  Has anyone contacted Adobe Systems to find out why the Flash Player does not work with OS 10.6.8 and what they plan to do about it?

    Where are you getting Flash from?
    Get the appropriate dmg installer here and then run it.
    http://www.adobe.com/products/flashplayer/distribution3.html
    If it still won't install, do these two things: First uninstall any Flash by going into the second level Hard Drive Library>Internet Plug-ins, and trash the Flash Player.plugin and flashplayer.xpt. Then boot into Safe Boot, Shift at the startup chime (give it much longer than a usual boot) and run the installer while booted in Safe Boot.

  • My IPad cannot download live Tv from skygo. I have no problem with my lap top so I assume the broad band is okay. Can anybody suggest why the live streaming will not work on my iPad one.

    My IPad cannot download live Tv from skygo. I have no problem with my lap top so I assume the broad band is okay. Can anybody suggest why the live streaming will not work on my iPad .

    Are you using the Sky Go app to try and watch it ? If so are you logged in with your Sky account ?
    If you are using the app then you could try closing the app completely and see if it works when you re-open it : from the home screen (i.e. not with Sky Go 'open' on-screen) double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of the Sky Go app to close it, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.
    If that doesn't work then you could try a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.

  • Why does one particular website not open on my ipad*,

    Why does one particular website not open on my ipad, when it alwasys did, but the same website is available upstairs on my PC, I'm using the same remote connection but for some reason it doesn't want to open.  I;ve tried refreshing etc... but nothing works.
    When I bring the ipad to work the website in question opens OK.
    Any suggestions??
    Thanks

    Try updating via iTune (computer)

  • Why does my card reader not work on my iPad since upgrade?

    I use my iPad mini to download photos from my camera when I'm on the road. In the summer I bought the "3 in 1 Card Reader Adapter Cable Camera Connection Kit, 3 Port Card Reader for iPad 4 and iPad Mini by Eurekka" and it worked wonderfully. I was able to download photos (jpg and RAW) directly to the iPad and off the camera, and once home it was a flawless upload to my iMac.
    However, once I upgraded to iOS 7 last week I get a message saying the device is not supported. What gives? Will this be fixed or will Apple products only accept Apple accessories from now on?

    No but I was just trying to find a way in to your help desk. I didn't find 
    your web page very helpful in this regard.
    Douglas Whiteley
    In a message dated 10/05/2012 20:43:50 GMT Daylight Time, [email protected] 
    writes:
    Re:  why does my adobe reader not work
    created by Claudio  González
    (http://forums.adobe.com/people/Claudio+González)  in Adobe Reader - View the full  discussion
    (http://forums.adobe.com/message/4395059#4395059)

  • Why does the remote app not work with Apple TV 1st gen anymore.

    This is a review I just left on the app store, I am posting it word for word, and i hope that dowsnt complicate anything. My hope is that this finds the right party to address the situation, and if any user has a fix, I would love to hear it.
    I have an Mac mini running iTunes as a server, I have 2 airport expresses to allowing airplay to them for different rooms, and I also have 2 Apple TV first gens... I can play one stream of music from the server, and have the option of playing 2 other streams of music from the apple tv's as they have a built in hard drive to sync music to. I can send any of the feeds to any o the devices in any room and i love it. This whole system used to work flawlessly... It doesn't anymore. The latest update of remote broke what was working so well. I can pull it up and see all 3 music sources, log into each and play music, no problem there. The problem is that when I want to log back into that device, it won't show what music is playing. It loads up to a trackpad... Why do I need a trackpad? the point of a wifi remote is that it interfaces directly with the library, not needing to see the display...  Annoying enough in itself as none of my devices are actually hooked up to a screen, but whatever, annoying point aside, I back out of the trackpad and refresh the device playing music... The music is playing, but won't show on my remote, I can't pause, press next song or anything. I have to start over and pick a song and override the currently playing song. Even the volume control is broken. I used to control each volume of each of the multiple devices individually, they each had a slider in the multiple speaker view, now there is only one master volume slider... One speaker is in my baby's room... If she is sleeping I don't want to have to go into the room to physically adjust that speaker, I want an individual slider like there was before.
    I used to be very happy with this app. I'm not anymore. I used to praise apple and promote the functionality of it to all of my friends. Now I'm just embarrassed when I can't control it when they are over. Embarrassed....
    As another fail.... I want to describe another point. As I have the iTunes server, it should be able to handle multiple things at once. It can to an extent... For example, I can play music from the server to an airplay device, and I can go onto my iMac, load up iTunes, click on shared libraries ad load my entire library from my server. I ca also at the same time take my iPhone, click on music, and again pull up my entire shared library of music from the wifi server... It handles this very well. I recently purchased an Apple TV 3. As it does not have a built in hard drive, it relies on content from a locally attached network or stuff from your iTunes account. So while I can use my iPhone to pull up the entire shared library while its also playing elsewhere, why can Apple TV 3 not?... It's using iOS just like my iPhone. All it was good for was airplay as an extra speaker. It wouldn't work as an extra rendered source of media using the shared library. Needless to say, that Apple TV went back to the store. Fail Apple, Fail.... That was the only reason I bought one. Maybe Apple TV 4 will actually be functional without a hard drive.

    Working fine on my system
    If on wifi, try ethernet
    Make sure router is up to date
    Reboot all components

  • Why is my apple id not working

    I wonder why my apple id is not working please help me out FAST or ASAP

    How about some more information. Any error messages? What happens when you try to make a purchase or download an app?

  • Why is my site Title not showing in Firefox?

    Hello
    On my site at http://fbibiz.com/, the page Title flashes briefly in the Title bar, but then reverts to 'Mozilla Firefox'. The title tag is in place (correctly as far as I can see).
    Any suggestions, please, as to why my page Title is not showing correctly?
    Thanks,
    Jon

    Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web page development issues with Firefox. <br />
    http://forums.mozillazine.org/viewforum.php?f=25 <br />
    You'll need to register and login to be able to post in that forum.

  • Why is my iPad suddenly not opening the Yahoo home page? I get a message saying Safari can not open the page due to too many redirects. This started yesterday. I shut my iPad down and still no luck.

    Why is my iPad suddenly not opening the Yahoo home page? I get a message saying Safari can not open the page due to too many redirects. This started yesterday, and I have already tried shutting off my iPad.

     

  • Why is my billing information not being review correctly...like it sayes my apple id has not yet been used in the itune store and it tells me to review my account info but for some reason it doesnt work

    why is my billing information not being review correctly...like it sayes my apple id has not yet been used in the itune store and it tells me to review my account info but for some reason it doesnt work

    Hi there ethangabe,
    You may find the information in the article below helpful.
    Using an existing Apple ID with the iTunes Store, Mac App Store, and iBooks Store
    http://support.apple.com/kb/ht2589
    -Griff W. 

Maybe you are looking for