Why do we need static for main() .........?

Why do we need static for main method
class Sample
public static void main(String args[])
System.out.println("HI EVERYONE");
}

The Java virtual machine is another term for the Java interpreter, which is the code that ultimately runs Java programs by interpreting the intermediate byte-code format of the Java programming language. The Java interpreter actually comes in two popular forms: the interpreter itself (called java) that runs programs via the command line or a file manager, and the interpreter that is built into many popular Web browsers such as Netscape, HotJava, and the appletviewer that comes with the Java Developer's Kit. Both of these forms are simply implementations of the Java virtual machine, and we'll refer to the Java virtual machine when our discussion applies to both. When we use the term java interpreter, we're talking specifically about the command line, standalone version of the virtual machine; when we use the term Java-enabled browser (or, more simply, browser), we're talking specifically about the virtual machine built into these Web browsers.
excerpts Orelly "Java Threads" Chapter 1. (If you don't believe me). Did i do any fundamental wrong by saying interpreter ? Is that a Sin ?
That is why i told concentrate on what answer I gave regarding the question. I am not going to argue any more. If you don't like my comments then I am Sorry :(

Similar Messages

  • Why do we need cygwin for Apps R12 on windows ?

    Hi,
    Can someone throw some light on
    ---Why do we need cygwin for Apps R12 on windows ?
    Which kind of activites need cygwin for R12 Apps.
    -sasi

    Hi Sasi;
    You need to use mkstoolkit or cywgwin to work EBS on windows coz of to can run some perl and also can use some command as kill, ps, ls etc..Apps tier also need that program can compile something inside.
    Please see:
    The Cygwin tools are ports of the popular GNU development tools for Microsoft Windows. They run thanks to the Cygwin library which provides the POSIX system calls and environment these programs expect.
    With these tools installed, it is possible to write Windows console or GUI applications that make use of significant parts of the POSIX API. As a result, it is possible to easily port many Unix programs without the need for extensive changes to the source code. This includes configuring and building most of the available GNU software (including the packages included with the Cygwin development tools themselves) as well as lots of BSD tools and packages (including OpenSSH). Even if the development tools are of little to no use to you, you may have interest in the many standard POSIX utilities provided with the package. They can be used from one of the provided Unix shells like bash, tcsh or zsh, as well as from the standard Windows command shell if you have to for some sad reason.
    http://www.cygwin.com/
    Regard
    Helios

  • Why do we need DSO for G/L Data?

    Hello Experts,
    In G/L all transactions are associated with a Document number. If there are any reversals it will create new document no.
    If I have document no. in the cube why do we need to use DSO for FI-GL extraction?
    Thank you
    Sree

    FI-GL Extractors deliver only after image of delta , DSO will generate the before and after image if any changes to the documents .
    Thats way we need staging DSO for FI extractors ..
    Ravi

  • Why do we need UPA for rehydrating users in Sharepoint provider hosted app scenario?

    Our on prem. SPS 2013 environment is configged to authenticate through ADFS against a third party IDP. We know nothing about these users, the returned SAML contains a role and based on this role we authorize user in SPS. This works great.
    No we are investigating high-trust provider hosted apps (on prem, no azure acs). We have created a simple MVC, and configged it to use ADFS. Now if users are authenticated from SPS they can call the MVC and the ADFS token is reused. Works perfect. Only thing
    is that whenever we need to call Sharepoint code through the client objectmodel, we get a 401 and the ULS shows that SPS is not able to map the incoming user to a user in User Profile DB. Off course it can't because the user is not in UPA and cannot be in
    UPA beacuse the users are stored outside our domain and there is no way to sync these to our SPS environment. I read a couple of blogs about this issue and the all say that we ned to sync with the user repository to fill upa; but again that cannot be (suppose
    on of our IDP's was facebook...?)
    The construction works if we use apponly security, but now we lose our SPS security. So my real question is, can we some how workaround User Profile service in the scenario, or at least without needing to sync these users.
    Any help/guidance is much appreciated!
    Sander

    Hi John,
    No we were not able to find a solution. The provider hosted app-model of SPS 2013 just does not take into account that in some cases useraccounts are not available. We could not find a way around user rehydration. Off course you can all ways use another
    security model like app-only policies, but that was not sufficient for us. It was also kind of disappointing there was no way to handle this; th emost problematic for me personal is that I cannot think of a reason why the rehydration can not be skipped in
    some way. If you configure it to run within SPS itself, rehydration is not necessary, so why it seams mandatory in provider hosted app beats me ;-)
    We went back to good old farm-solutions with webparts. 
    Sorry 
    Sander

  • Why do we need Wallaby for HTML5?

    I'm wondering why adobe is doing all this hardwork of converting FLA to HTML5, when we all know that HTML5 cannot do all the stuff Flash can do. Though I appreciate the emerging standard as the way to go. But Adobe has a better tool to deliver this experience for designers-  It's call Flash Catalyst. Flash Catalyst is a User Interaction tool which is best suited for this. I believe Adobe is working under tremendous pressure to provide a solution to the apple embarrasment  of not supporting Flash. In order not to sound to simple. I believe we can have an export/publish option to HTML5 from Adobe catalyst. This makes more sense to me if you agree - Flash Catalyst to FLEX/SWF/AIR/HTML5.
    I think Adobe should leave Flash Pro out of the HTML5 debate now after all Flash is not supporting the most fundamental features that can be a game changer.

    There was already a demo from an Adobe conference a few years ago or perhaps one year ago where someone demonstrated how
    to export Illustrator and SWF documents from Dreamweaver into "HTML5 Canvas".  Canvas
    is some type of tag that allows SVG and SWF filetypes to be rendered within the browser using HTML5 standards.  If you search for HTML5 Canvas and the word SWF or Flash within the same query string you will likely come up with the video demonstrating this feature.  If you look through my profile for HTML5 Canvas or HTML Canvas you will look for a question I posed about this technology as well.
    Best,
    -markerline

  • Why do I need iTunes for getting podcasts and other subscriptions.

    Ok, to be fair, I do love my two iOS devices (iPhone and iPad). I have used these for just over a year now and I'm still impressed about speed and stability.
    There's one thing though that annoys the **** out of me: The inability to automatically get my subscriptions for podcasts, without having to connect my iOS-devices to my computers iTunes.
    I use a number of operating systems on a daily basis and that makes it hard to have one centralized location for an iTunes installation. This means I end up having to track releases manually and download them (through the mobile version of iTunes I might add) to my devices.
    What could possibly be the reason for Apple not to support this?
    Is there a place for such feature requests, somewhere on this site?
    If this is it then I would like ask for the following:
    - automatically sync all subscribed media directly on the iOS-device
    - timetracking between devices. Just like with the iBooks (awesome feature!)
    Message was edited by: EmilHaukeland

    Is there a place for such feature requests, somewhere on this site?
    Apple does not normally read these forums so use the following:
    [http://www.apple.com/feedback/|http://www.apple.com/feedback>

  • Why do we need bw for hr reporting?

    hi friends,
    adhoc reporting tools for reporting in hr module, what is the use of bw to make reports than adhoc reporting tool. any advantages for bw?please give me clarification.
    Thanking u
    suneel.

    Suneel,
    Being analytical and flexible on reporting front using BW is advantageous for any module wether it is HR or FI etc.
    Incase of HR using BW reports will help you to synchronize the ESS ( Employee Self Service ) , MSS ( Manager Self Service functionalities ) and reports as single sign when you use EP. Also the new breed of HCM analytics gives the HR personel a snap shot of FTE ( Full Time Employee) performance and based on utilization staff augumentation planning can be executed.
    Hope u got the point and reward points if it helped
    Raja

  • Why do we need private static method or member class

    Dear java gurus,
    I have a question about the use of private and static key words together in a method or inner class.
    If we want to hide the method, private is enough. a private static method is sure not intended to be called outside the class. So the only usage I could see is that this private static method is to be called by another static method. For inner class, I see the definition of Entry inner class in java.util.Hashtable, it is static private. I don't know why not just define it as private. Could the static key word do anything better.
    Could anybody help me to clear this.
    Thanks,

    What don't you get? Private does one thing, andstatic does >something completely different.
    If you want to listen to music, installing an airconditioner doesn't help>
    Hi, if the private keyword is the airconditioner, do
    you think you could get music from the static keyword
    (it acts as the CD player) in the following codes:You're making no sense and you're trying to stretch the analogy too far.
    Private does one thing. If you want that thing, use private.
    Static does something completely different and unrelated. If you want that thing, use static.
    If you want both things, use private static.
    What do you not understand? How can you claim that you understand that they are different, and then ask, "Why do we need static if we have private"? That question makes no sense if you actually do understand that they're different.

  • Why is serial# needed for unique session info

    hello everybody,
    as you know, a session is unique with 2 fields, SID and SERIAL# which exist on v$session view.
    my question is why is serial# needed and for which case serial# is changing.
    now, you can say that, "only oracle developers know this, that is the design" but what i mean is, for ex: if i wanted to find a session which is blocked by another session, I use this:
    select * from v$session where blocking_session is not null;in blocking_Session field, oracle gives me the session id (SID) which is blocking a session. so i can use this SID and i can kill it for instance but SID is not unique for a session I can find more than one session with same SID which one is the blocking one ?
    in real life i didnt see an example of that, there is no same sid in system like my blocking session example. so I believe that serial# is assigning for another purpose, I mean, i thougth that it could be for autonomous transaction, maybe they user same sid but differen serial# but when i tested it, i saw that i was wrong.
    so, why serial# is exists. if this is a design issue, how can i find a blocking session by just using SID info ?
    thanks a lot.

    Not surprisingly, an explanation may already be found in the documentation (and copied in Rene's reply above):
    See http://docs.oracle.com/cd/E11882_01/server.112/e25513/dynviews_3016.htm (column description).
    Or search:
    http://www.oracle.com/pls/db112/search?word=sid+serial%23&partno=
    Besides for terminating sessions, serial# may be relevant when e.g. tracing sessions (SQL Trace).
    Not sure what type of example you were looking for, but I came up with this in about five seconds:
    C:\Users>sqlplus blocker_user
    Enter password:
    Connected to:
    Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production
    SQL> select sid,serial# from v$session where sid=(select sid from v$mystat where rownum=1);
           SID    SERIAL#
           136         27
    SQL> conn other_user
    Enter password:
    Connected.
    SQL> select sid,serial# from v$session where sid=(select sid from v$mystat where rownum=1);
           SID    SERIAL#
           136         29Edited by: orafad on Feb 1, 2012 12:18 AM

  • Why do we need IDE or tools for java card programming?

    Hi,
    I am a newbie to java card, using java card kit tools themself, we can test and burn the code into card right?
    then why do we need IDE for java card, please correct me , if i am wrong,
    Thanks in advance,
    Sri.

    Dear Sri,
    We have compiler, linker etc for every language starting of from C or C++ or Java. JDK has all the tools necessary to develop and run a Java program. Similarly Java Card Development Kit has all the tools for developing and deploying a Java Card applet. But what an IDE does is too integrate all these tools and make it easier for the JavaCard programmer to develop his applets. Just like Eclipse is used for Java applet development.And not everytime the code is burned to the card. Its only during masking code is burned to the card, i.e if u can call it burning. Masking makes an applet permanent on the card.

  • Why do we need to put \\\\ for inserting a single \

    Hi,
    I wanted to replace the string h"i with h'i. The following code does that.
    public class replace {
         public static void main(String a[]) {
              String hel = "h\"i";
              System.out.println(hel);
              hel = hel.replaceAll("\"","\\\\");
              System.out.println(hel);
    My question is why do we need to put 4(\\\\) back slash for inserting a single \? Why not just put 2(\\) back slash? Your help is appreciated.
    Sundar.

    Hi,
    Could you please explain bit more on this. Im talking about the second argument in replaceAll method.
    All i want is to replace the double quote in the string h"i with h\i.
    Why cant the code look like this hel = hel.replaceAll("\"","\\");
    If i use this code i get the following exception.
    Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 1
    at java.lang.String.charAt(Unknown Source)
    at java.util.regex.Matcher.appendReplacement(Unknown Source)
    at java.util.regex.Matcher.replaceAll(Unknown Source)
    at java.lang.String.replaceAll(Unknown Source)
    at hello.main(hello.java:70)

  • Why do i need to declate methods two times for this program work

    Hi,
    why should i have to declare 2 times the methods
    public void mouseClicked(MouseEvent e) {    }
    public void mousePressed(MouseEvent e) {    }
    public void mouseReleased(MouseEvent e) {    }
    public void mouseEntered(MouseEvent e) { }
    public void mouseExited(MouseEvent e) {  }
    to make this program work? why when i declate 1 time this program doesn't work good?
    import java.awt.*;*
    import javax.swing.;
    import java.awt.datatransfer.*;
    import java.io.FileReader;
    import java.io.IOException;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseEvent;
    public class Main extends JPanel implements MouseListener {
    public Main() {
    super(new GridLayout(2,2));
    final JTextArea jt= new JTextArea("dear test :) ",5,20);
    FileReader reader = null;
    System.err.println("Error closing reader");
    exception.printStackTrace();
    JButton bu = new JButton("copiar");
    final Clipboard clipboard = getToolkit().getSystemClipboard();
    //new add
    add(nn);
    add(tt);
    bu.addMouseListener(new MouseListener() {
    public void mouseEntered(MouseEvent e) {
    StringSelection data = new StringSelection(jt.getText());
    clipboard.setContents(data, data);
    public void mouseClicked(MouseEvent e) {
    public void mousePressed(MouseEvent e) {
    public void mouseReleased(MouseEvent e) {
    public void mouseExited(MouseEvent e) {
    private static void createAndShowGUI() {
    //Create and set up the window.
    JFrame frame = new JFrame("TextDemo");
    public static void main(String[] args) {
    //Schedule a job for the event dispatch thread:
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    public void mouseClicked(MouseEvent e) {    }
    public void mousePressed(MouseEvent e) {    }
    public void mouseReleased(MouseEvent e) {    }
    public void mouseEntered(MouseEvent e) { }
    public void mouseExited(MouseEvent e) {  }
    }

    import java.awt.;
    import javax.swing.;
    import java.awt.datatransfer.*;
    import java.io.FileReader;
    import java.io.IOException;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseEvent;
    public class Main extends JPanel implements MouseListener {
    public Main() {
    super(new GridLayout(2,2));
    final JTextArea jt= new JTextArea("dear test :) ",5,20);
    FileReader reader = null;
    System.err.println("Error closing reader");
    exception.printStackTrace();
    JButton bu = new JButton("copiar");
    final Clipboard clipboard = getToolkit().getSystemClipboard();
    //new add
    add(nn);
    add(tt);
    bu.addMouseListener(new MouseListener() {
    public void mouseEntered(MouseEvent e) {
    StringSelection data = new StringSelection(jt.getText());
    clipboard.setContents(data, data);
    public void mouseClicked(MouseEvent e) { }
    public void mousePressed(MouseEvent e) { }
    public void mouseReleased(MouseEvent e) {}
    public void mouseExited(MouseEvent e) { }
    private static void createAndShowGUI() {
    //Create and set up the window.
    JFrame frame = new JFrame("TextDemo");
    public static void main(String[] args) {
    //Schedule a job for the event dispatch thread:
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    public void mouseClicked(MouseEvent e) { }
    public void mousePressed(MouseEvent e) { }
    public void mouseReleased(MouseEvent e) { }
    public void mouseEntered(MouseEvent e) { }
    public void mouseExited(MouseEvent e) { }
    } the problem is this line bu.addMouseListener(new MouseListener() {
    if i change this to bu.addMouseListener(this() {
    it gives error saying expected ')'
    and then doesn't compile.
    i just don't know why , although the program runs when i declare the methods two times,
    but i think it's better java code , if i learn it why is this error and correct it

  • Why do we need to point at main program when activating include?

    Hi There Abapers,
    Just a quick question, because I faced such issue when implementing OSS notes.
    When activating objects I am asked to point out the main program for one of includes changed.
    This inclde is used in ~30 programs.
    As far as OSS note doesn't say a word about main program in fact I am not able to check it, I need to pick random program from a list up.
    The question is...
    Why do we need to point at main program when activating include as we are only changing the sub-object (include)?
    Will this 'random main program selection' bring some negative effects in the future?
    Will be thankful for some expert opinion
    Kind Regards,
    P.

    You should check all main programs when activating an include, to make sure that all main programs are still syntactically correct even with the changed include.
    Thomas

  • Why do we need material specification for transfering results to class char.

    Hi,
    Can you guys tell me why do we need to create material specification if we want to transfer quality inspection results to a batch class?
    Basically I have done the following:
    -Create Class Characteristic
    -Assign the Class Characteristic to a batch class
    -Link Class Char.  to MIC
    -Assign MIC to an Inspection Plan
    -Post GR, batch and inspection lot are created automatically
    -Record Results for inspection Lot
    -Make UD for Inspection Lot
    The result is not transferred to batch class, then I create material specification with the MIC assigned, the results can be transferred. But why?
    Best regards
    Danny

    Hello Danny,
    This is a standard program, which checks for this indicator at the time of inspection lot completion.
    F1- help gives satisfactory explanation
    Batch Valuation Possible Without Specification
    Use
    If you set this indicator, a link between the master inspection
    characteristics and the class characteristics for the batch class must exist
    when an inspection lot is created, for batch valuation to occur when the usage
    decision or inspection point valuation is made. A link within the material
    specification is not required.
    If you do not set this indicator, batch valuation only occurs when the
    usage decision or inspection point valuation is made, if a link using the
    material specification exists between the master inspection characteristics and
    the class characteristics for the batch class. In this way, you can control on a
    material-dependent basis whether the batch characteristics are valuated based on
    the inspection results.
    Amol.
    Message was edited by: Amol Manave : Main purpose is you can control whether Batch characteristics should be valuated based on results or not for particular material. If you set this indicator then batch characteristics will be valuated for all materials and in opposite case Batch characteristics will be valuated for only materials for which Material Specification exists.

  • I want to know that if i want to download facebook on my iphone 4 or any other apps then it ask me put my card details for payment. why is that. if they are free then why do i need to give my card details?please help me anyone.

    I want to know that if i want to download facebook on my iphone 4 or any other apps then it ask me put my card details for payment. why is that. if they are free then why do i need to give my card details?please help me anyone.

    Just select no credit card as outlined here:
    http://support.apple.com/kb/ht2534

Maybe you are looking for