Methods outside main()

Hello,
Can have methods outside main() ?
I am trying to call abc and says non-static method abc() cannot be referenced from a static context
abc();
When I make it static it is compiling but I dont want it to be a static method...
public static void main( String[] as )
          abc();
     public void abc( )
//Prints Hello
}

No I dont have too much of a C/C++ background but I am
curious about static variable and methods..
I can understand that we need to use static methods
when you want the value to be same across all objects
and at the same time can be changed....
for example:
Object 1
public static String loc = "location:4444";
Object2 calls
loc = "location:5555"
so if object 2 changes port or location... Object 1's
loc also changes...
So this means that when we are going to change the loc
later on somewhere we can make it static... Otherwise
if our location will never change and always be
location:4444 then we are better off making that
variable final and not static.
Am I right?I'm not really following what you're asking, but static and final are not mutually exclusive. One of the most common uses of static member variables is as class-wide constants--either public or private--in which case they are also final.

Similar Messages

  • How do I declare a native method outside of the main class?

    Hi
    This is a JNI particular question.
    I am having a problem with generating the header .h file after executing javah. The file is generated correctly but is empty under certain circumstances.
    This is the 'empty file:
    =================
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class gui_GuiMain */
    #ifndef Includedgui_GuiMain
    #define Includedgui_GuiMain
    #ifdef __cplusplus
    extern "C" {
    #endif
    #ifdef __cplusplus
    #endif
    #endif
    This is what it should look like:
    =========================
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class gui_GuiMain */
    #ifndef Includedgui_GuiMain
    #define Includedgui_GuiMain
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class: gui_GuiMain
    * Method: getValueOIDTestMIB
    * Signature: ()V
    JNIEXPORT void JNICALL Java_gui_GuiMain_getValueOIDTestMIB
    (JNIEnv *, jobject);
    #ifdef __cplusplus
    #endif
    #endif
    The header file becomes "empty" when the native function getValueOIDTestMIB is declared in a different class than what my main() function is declared in.
    For example something like this will work:
    class Main
    public native void getValueOIDTestMIB
    static {
    System.loadLibrary("libsnmp++");
    //............some more functions etc.............
    public static void main(String[] args)
    //............some more stuff...........................
    But when I declare this:
    public native void getValueOIDTestMIB
    static {
    System.loadLibrary("libsnmp++");
    outside the class, in another class within the same package, nothing happens.
    I am probabily doing something stupid. Can somebody help or give me some guidance to where I should look. I come from a C++ background, not a guru in Java.
    Thanks

    You need to run javah and give it as a parameter the full class name of the class which contains the native methods.
    For example (if your class is called A and its package is a.b.c)
    javah -jni a.b.c.A

  • Instantiation outside main method

    Why can't you do the following? I get an error message: Java programs\Exp.java:14: non-static variable scan cannot be referenced from a static context
    boxes = scan.nextInt(); I don't understand this message since you can instantiate objects and initialize variables within a class and outside a method with no problem. What's so special about the main method that you cannot do this? By the way, I know how to fix this. I just want to know why you can't do this.
    import java.util.Scanner;
    public class Exp
         Scanner scan = new Scanner(System.in);
         public static void main(String[] args)
              int boxes;
              System.out.println("Enter a number: ");         
              boxes = scan.nextInt();
              if(boxes > 5)
                   System.out.println("So what!");
              else
                   System.out.println("Less than!");
                   System.out.println("I don't know.");
    }

    afried01 wrote:
    Well, if the objects are instantiated outside the main method then none of them could be used inside that method. You would have to use them outside the main method or any other static method, that is, if I'm getting your point correctly.No. You could still use them within the main method, but first you'd have to instantiate an object of the class.
    Keep in mind that your main method should be pretty lightweight. You should only use it to bootstrap your program (i.e., to start it up at the beginning). So generally you'd instantiate the primary classes of your application, maybe call an initialization or start method on one of them, etc. If your main method is more than 15 or so lines of code it's probably too heavy.
    Or you could just make the field (outside the main class) static, so the (static) main method could use them, but as mentioned already that's generally not the right approach.

  • How do I print out the value returned by a method in main??

    I'm a total newbie at java, I want to know how I can print out the value returned by this function in the "Main" part of my class:
    public int getTotalPrice(int price)
    int totalprice=price+(price*0.08);
    return totalprice;
    I just want to know how to print out the value for total price under "public static void main(String[] args)". thanks in advance,
    Brad

    Few ways you could do it, one way would be to create an instance of the class and call the method:
    public class Test
        public double getTotalPrice(int price)
            double totalprice = price + (price * 0.08);
            return totalprice;
        public static void main(String[] args)
            Test t = new Test();
            System.out.println(t.getTotalPrice(52));
    }Or another would be to make getTotalPrice() static and you could call it directly from main.

  • SAP Script: Include text in MAIN window prints outside MAIN window margins

    Hi,
    We're facing a peculiar issue. We call a text element in the MAIN window of an SAP Script form using FM WRITE_FORM.
    The element has 2 includes.
    The problem is that when the content of any of the 2 includes is large enough, the include text prints overflows outside the MAIN window margins on the first page and into the area of the footer window of the same page. It does not automatically flow to the next page MAIN window.
    We have checked that the MAIN window and FOOTER window margins do not overlap. Infact they are quite far from each other.
    We have tried stuff like using a forced PROTECT, change the para format etc, but nothing solves the problem.
    Does anyone have any idea?

    You do not need to use the subroutine READ_ORDER_TEXT to get another text name because you already have it: TMP_TXNAM2 .
    Pass this value back to your SAPscript, and it is okay.
    Or you can even check the text object is empty or not, if no text is found, print 2 empty lines:
    still use your subroutine to read the text, if no line is found, set TMP_TXNAM2  to empty, otherwise, no change,
    In SAPscript, check the value is empty or not, then print 2 empty line or the text object...

  • Using mutator and accessor methods in main.

    Would somebody explain to me exactly how mutator and accessor methods make a class and it's driver program work together. I understand the principle of encapsulation, but I'm obviously missing something. I get the syntax, but what actually happens? I'm hoping a fresh perspective on it will help me understand better.
    I guess another way to ask the question could be: how do you use accessor and mutator methods in the main program that calls them?

    >
    the assignment says to have a
    "reasonable set of accessor and mutator methods
    whether or not you use them". So in my case I have
    them written in the class but do not call them inthe
    driver program. And like I said, the program does
    what it's supposed to do.This class you're in worries me. I'm sure what
    polytropos said is true: they're trying to make you
    think about reuse. But adding to an API without cause
    is widely considered to be a mistake, and there are
    those who are strongly opposed to accessors/mutators
    (or worse, direct field access) on OOP design grounds.The class is based on the book Java: Introduction to Computer Science and Progamming, by Walter Savitch. Until now I've been pretty happy with it. Another problem, to me anyway, is that so far we've done a few, cumulative programming projects per chapter. This time, there was one assignment for the whole chapter that is suppsoed to incorporate everything. But that's just me complaining.
    Here is the code I have and that it looks like I'll be turning in... criticisms welcome.
    Here is the class:
    public class GradeProgram//open class
         private double quiz1;
         private double quiz2;
         private double mid;
         private double fin;
         private double finalGrade;
         private char letterGrade;
         public void readInput()//open readInput object
              do
                   System.out.println("Enter the total points for quiz one.");
                   quiz1 = SavitchIn.readLineInt();
                   System.out.println("Enter the total points for quiz two.");
                   quiz2 = SavitchIn.readLineInt();
                   System.out.println("Enter the mid term score.");
                   mid = SavitchIn.readLineInt();
                   System.out.println("Enter final exam score.");
                   fin = SavitchIn.readLineInt();
                   if ((quiz1>10)||(quiz2>10)||(quiz1<0)||(quiz2<0))
                   System.out.println("Quiz scores are between one and ten.  Re-enter scores");
                   if ((mid>100)||(fin>100)||(mid<0)||(fin<0))
                   System.out.println("Exam scores are between zero and one hundred.  Re-enter scores.");
              while ((quiz1>10)||(quiz2>10)||(quiz1<0)||(quiz2<0)||(mid>100)||(fin>100)||(mid<0)||(fin<0));
         }//end readInput object
         public void output()//open output object
              System.out.println();
              System.out.println("You entered:");
              System.out.println("Quiz 1: " + (int)quiz1);
              System.out.println("Quiz 2: " + (int)quiz2);
              System.out.println("Mid term: " + (int)mid);
              System.out.println("Final exam: " + (int)fin);
              System.out.println();
              System.out.println("Final grade: " + (int)percent() + "%");
              System.out.println("Letter grade: " + letterGrade());
         }//end output object
         public void set(double newQuiz1, double newQuiz2, double newMid, double newFin, double newFinalGrade, char newLetterGrade)
              if ((newQuiz1 >= 0)&&(newQuiz1 <= 10))
              quiz1 = newQuiz1;
              else
                   System.out.println("Error: quiz scores are between zero and ten.");
                   System.exit(0);
              if ((newQuiz2 >= 0)&&(newQuiz2 <= 10))
              quiz2 = newQuiz2;
              else
                   System.out.println("Error: quiz scores are between zero and ten.");
                   System.exit(0);
              if ((newMid >= 0)&&(newMid <= 100))
              mid = newMid;
              else
                   System.out.println("Error: exam scores are between zero and one hundred.");
                   System.exit(0);
              if ((newFin >= 0)&&(newFin <= 100))
              fin = newFin;
              else
                   System.out.println("Error: exam scores are between zero and one hundred.");
                   System.exit(0);
              letterGrade = newLetterGrade;
         public double getQuiz1()
              return quiz1;
         public double getQuiz2()
              return quiz2;
         public double getMid()
              return mid;
         public double getFin()
              return fin;
         public char getLetterGrade()
              return letterGrade;
         private double finalPercent()//open finalPercent object
              double quizPercent = (((quiz1 + quiz2) /2) * 10) / 4;
              if (((((quiz1 + quiz2) /2) * 10) % 4) >= 5)
                   quizPercent++;
              double midPercent = mid / 4;
              if ((mid % 4) >= 5)
                   midPercent++;
              double finPercent = fin / 2;
              if ((fin % 2) >= 5)
                   finPercent++;
              finalGrade = (quizPercent + midPercent + finPercent);
              return (finalGrade);
         }//end final percent object
         private double percent()//open percent object - helping object
              double percentGrade = finalPercent();
              return (percentGrade);
         }//end percent object
         private char letterGrade()//open letterGrade object
              double letter = percent();
              if (letter >= 90)
                   return ('A');
              else if (letter >= 80)
                   return ('B');
              else if (letter >= 70)
                   return ('C');
              else if (letter >= 60)
                   return ('D');
              else
                   return ('F');
         }//end letterGrade object
         private double quizScore()//open quizScore object
              double quizes = ((quiz1 + quiz2) /2) * 10;
              return (quizes);
         }// close quizScore object
    }//end classAnd here is the driver program:
    public class GradeProgramDemo
         public static void main(String[] args)
              String cont;
              do
                   GradeProgram firstStudent = new GradeProgram();
                   firstStudent.readInput();
                   firstStudent.output();
                   System.out.println();
                   System.out.println("Enter more student grades?  Enter Y to continue");
                   System.out.println("or press enter to quit.");
                   cont = SavitchIn.readLine();
                   System.out.println();
              while (cont.equalsIgnoreCase("y"));

  • Please Help !!!How to pass variable defined in Event Listener Method outside it.

    Hi, everybody
    I have 3-4 swf those i want to load one after another like a slideshow.What i  want to do is get the total frames of loaded swf and want to pass that value to Timer object's delay parameter.  i have converted total frames to milliseconds so i can use it in timer constructor. But i am not getting the value of that variable outside of my Event.COMPLETE listener method. Here is my code what i have done, Please have a look and guide me what i am missing.
    var fr = stage.frameRate;
    var m:MovieClip = new MovieClip();
    var ms;
    var swf:XML =
                       <swfs>
                                 <swf filename="1.swf"/>
                            <swf filename="2.swf"/>
                            <swf filename="3.swf"/>
                    </swfs>;
    import flash.display.*;
    import flash.net.URLRequest;
    function loadSwf(num)
       var ldr:Loader = new Loader();
        var url:String = swf.swf[num].attribute("filename");
        var urlReq:URLRequest = new URLRequest(url);
        ldr.load(urlReq);
       ldr.loaderInfo.addEventListener(Event.COMPLETE, onC);
    function onC(e:Event):void
       var m:MovieClip = e.target.content as MovieClip;
       ms = m.totalFrames/fr;
       ms = ms * 1000;
    var timer:Timer = new Timer(ms);
    timer.addEventListener(TimerEvent.TIMER, onT);
    function onT(e:TimerEvent)

    Hi Ned,
    Thanks for your reply. i want to call loadSwf method in timerEvent. My aim is to load next swf movie after playhead play all frames of loaded swf. I hope you are getting my point. My aim is to play a slide show of swfs with not equal interval but after completion of each swf's animation, those total frames may differ. Am i going right or if you can suggest me a  better way then please tell me.

  • Cant call simple method from main method

    hi guys, this maybe a stupid question, im a newbie to java programming. Im trying to call the method calculateArea in main method and its not working.
    Any ideas?
    Thanks.
    package project1;
    public class makePurchase {
        public int calculateArea(int width, int height){
                int myArea = width * height;
                return myArea;
        public static void main(String[] args){
            int vTestResult = calculateArea(1,3);
            System.out.println("The total is:" +vTestResult);
    }

    jverd wrote:
    mishmash wrote:
    Is there a easy way of determining if the method should be static? maybe only if your using a math class and not using the method in any other class?Static means associated with the class as a whole, not with any particular instance. If your method doesn't use or set any state that is part of individual instances, it may be a candidate to be static. Another difference is that static methods cannot be overridden. That is, you can't defer until runtime which class' implementation of a static method to call.
    public class Person {
    private static int numPersonsCreated;
    private String name;
    private Date birthdate;
    public int calculateAgeInYears () {
    // use birthdate to calculate age
    public static int getNumPersonsCreated() {
    return numPersonsCreated;
    }Here, the calc method cannot be static, since it uses the birthdate field that is particular to each Person object created. The number of Person objects created by your program, however, is not associated with any particular Person object, but with the Person class as a whole, so it can be static.Perhaps to expand a bit more...
    Highly reusable methods are candidates for static such as utility methods that may be used multiple times.This is true if this methods API remains consistent and does not care a bout the surrounding class. Usually such a method would require all its fields to be provided by parameters or as static members as any instance variables would not make this methods reusable.
    in jverd's example you can see that many related classes may be interested in finding out how many people have been created and they may wish to know so at the same time. It certainly makes sense to provide such a method as static as it does not change and most likely never will. More importantly all interested classes now are assured of seeing the exact same method because that is what static is: It exposes the same to all interested parties.
    Edited by: Yucca on Oct 19, 2009 6:35 AM

  • Why do we make methods besides main private?

    just wondering why are some methods made private?

    885018 wrote:
    just wondering why are some methods made private?Because there's no need to call them from outside the class, and in fact, it could be harmful to do so.
    Think of a car. There are a few controls that you the driver have access to (public methods): Gas, brake, steering wheel, gearshift, etc. But there are many other mechanisms in your car that have jobs to do, that you don't need to touch and shouldn't touch, but that are invoked as a result of you interacting with the "public methods". For instance, you don't need to directly trigger the spark plugs to ignite the fuel-air mixture, so there are no switches in the driver's compartment for you to do so. That is a "private method" that is invoked as a result of what you do with the "public methods."

  • Error 1026 invalid reference at runVI invoke method in main exe- subVI- subpanel

    Hello,
    I have a main VI which have subVI's inside case structures set up to show FP when called and be modal.
    These subVIs have a subpanel that will pull up a dynamicVI using RunVI invoke method.The dymaicVIs path is built using application directory constant+the VI name to the invoke method.
    now the main VI is built into exe with the dynamicVIs in always included list. 
    when i run the main exe i am getting 1026 error VI reference invalid. 
    Plz help
    Thanks
    Solved!
    Go to Solution.

    Hi Freemason,
    The problem could be coming from the use of relative paths, because the path can sometimes change when building an application. Double check to make sure they are calling the right path. You can also try changing the AutoDispose Refnum in your run VI invoke node to false. It is one of the methods you can select in your run VI invoke node. If neither of these solutions work, run your code using the highlight execution function. If you implemented error handling in your program, you should be able to see the source of the error.
    If you’re still having issues, could you post some screenshots or your actual VI? I may be able to get a better idea of the issue that way. I’ve also attached an example VI that uses multiple subVIs and a subpanel for reference.  Hope this helps.
    Paul C
    Applications Engineer
    National Instruments
    Attachments:
    Multiple VIs in a Subpanel.vi ‏19 KB

  • How can i invoke a void method in main?

    Hi guys I am killing myself over why we use void method if we can't call on it from main.
    For example i am trying to create a program to calculate military time. In my main i am trying to call setHour which is void. setHour is supose to check if the input of hour is over 24 and if it is i have to reset hour to 00. But it gives an error that i can't call on that method because it is void.
    So how do i invoke it from main?
    and
    Why do we use void if we can't call on it?
    Thanks

    ok here it is mate. It is not finished but pay attention on the setMethods that is what im trying to invoke from main. Here's my methods and then main will be under it.
    public class MilitaryTime
          private int hour;
          private int minute;
          private int second;
           public MilitaryTime()
             hour=0;
             minute=0;
             second=0;
           public MilitaryTime(int hour, int minute, int second)
             this.hour=hour;
             this.minute=minute;
             this.second=second;
           public MilitaryTime(MilitaryTime t)
           public void setHour(int h)
             if(h>=24)
                h=00;
             else
                hour=h;
           public void setMinute(int m)
             if(m>=60)
                m=00;
             else
                minute=m;
           public void setSecond(int s)
             if(s>=60)
                s=00;
             else
                second=s;
           public int getHour()
             return hour;
           public int getMinute()
             return minute;
           public int getSecond()
             return second;
           public void tick()
             second=second+1;
           public String toUniversalString()
             StringBuffer     buffer;
             buffer = new StringBuffer();
          // add the hour (with leading zero if its neccesary)
             if(this.hour < 10)
                buffer.append("0");
             buffer.append(this.hour).append(":");
          // add the minute (with leading zero if its neccesary)
             if(this.minute < 10)
                buffer.append("0");
             buffer.append(this.minute).append(":");
          // add the second (with leading zero if its neccesary)
             if(this.second < 10)
                buffer.append("0");
             buffer.append(this.second).append("");
             return buffer.toUniversalString();
           public String toString()
             StringBuffer     buffer;
             buffer = new StringBuffer();
          // add the hour (with leading zero if its neccesary)
             if(this.hour < 10)
                buffer.append("0");
             buffer.append(this.hour).append(":");
          // add the minute (with leading zero if its neccesary)
             if(this.minute < 10)
                buffer.append("0");
             buffer.append(this.minute).append(":");
          // add the second (with leading zero if its neccesary)
             if(this.second < 10)
                buffer.append("0");
             buffer.append(this.second).append("");
             return buffer.toString();
       }Here is main where i try and call setHour to check for accuracy.
    import javax.swing.*;
    public class TestMilitaryTime
         public static void main(String[]args)
                        String sHour=JOptionPane.showInputDialog(null,
                "Input Hour:", "Military Time",JOptionPane.QUESTION_MESSAGE);
                        int hour=Integer.parseInt(sHour);
                        String sMinutes=JOptionPane.showInputDialog(null,
                "Input minutes:", "Military Time",JOptionPane.QUESTION_MESSAGE);
                        int minutes=Integer.parseInt(sMinutes);
                        String sSeconds=JOptionPane.showInputDialog(null,
                "Input seconds:", "Military Time",JOptionPane.QUESTION_MESSAGE);
                        int seconds=Integer.parseInt(sSeconds);
                        MilitaryTime time= new MilitaryTime(hour,minutes,seconds);
                        System.out.println(time.setHour());
                        System.out.println("The military time is you enterd is "+time.toString());
         Everything else works fine except the setHour thing.
    Thanks

  • How do I correct "No Such Method Error: main " ? ? ?

    Dear Java People,
    I have an error message in my program that says
    " No Such Method: main " . How do I correct this problem?
    Thank you in advance
    Stan

    Dear Java People,
    I have an error message in my program that says
    " No Such Method: main " . How do I correct this
    problem? It will be one of the following:
    -You don't have a main method at all
    -You don't have the correct signature for main. For instance it isn't static.
    -You are trying to run the wrong class. The main method is in a different class than the one you are specifying.

  • Painting from outside main class

    Im writing some generic code and im having trouble trying to get the called class to paint correctly. I have this code so far, and it works, but I dont like it. I pass in graphics as a parameter and it doesnt use the natural repaint method, so I was hoping someone could show me how to do this the "right way". I also want to avoid using threads, im pretty sure theyre not absolutely necessary.
    Theres 2 classes, essentially its
    class 1: paint a green splashscreen, user presses button> call class 2
    class 2: paint a white screen and moving ball
    (the while loop has been commented out so i can check the state of repaint. My normal programs automatically repaint if i minimise them, this one wont repaint properly).
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;
    public class Multi extends Applet implements ActionListener{
    Mgame game=new Mgame();
    private Button host;
        public void init() {
        setLayout(null) ;
        setButtons();
        public void paint(Graphics g) {
        g.setColor(Color.green);   
        g.fillRect(0,0,700,500); 
         public void setButtons() {
        host= new Button ("Host Game");
        host.setBounds(470,395,100,30);
        add(host);
        host.addActionListener(this);
         public void actionPerformed(ActionEvent event)
                  Graphics g = getGraphics();
                  game.gamerun(g);
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;
    class Mgame{
    int ballx = 0;
    Graphics g;
    public void xpaint(){
        g.setColor(Color.white);   
        g.fillRect(0,0,700,500);         
        g.setColor(Color.red);   
        g.fillOval(ballx, 40, 90, 90);
    public void gamerun(Graphics graphics){
        g=graphics;
        //while(true){
        ballx=ballx+1;
        if (ballx==500) {ballx=10;}
        try { Thread.sleep(100); } catch (Exception e) {}
        xpaint();
    }Thanks for any help.

    How would I fix that then?
    I tried using
    class Mgame extends Multi{
    <etc>
    }Which means that the program now compiles, but now the program seems to skip the Mgame.gamerun repaint() line, so the program looks like its freezed up.
    New code listing is:
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;
    public class Multi extends Applet implements ActionListener{
    Mgame game;
    private Button host;
        public void init() {
        game=new Mgame();
        setLayout(null) ;
        setButtons();
        public void paint(Graphics g) {
        g.setColor(Color.green);   
        g.fillRect(0,0,700,500); 
         public void setButtons() {
        host= new Button ("Host Game");
        host.setBounds(470,395,100,30);
        add(host);
        host.addActionListener(this);
         public void actionPerformed(ActionEvent event)
                  game.gamerun();
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;
    class Mgame extends Multi{
    int ballx = 0;
    public void paint(Graphics g){
        g.setColor(Color.white);   
        g.fillRect(0,0,700,500);         
        g.setColor(Color.red);   
        g.fillOval(ballx, 40, 90, 90);
    public void gamerun(){
        while(true){
        ballx=ballx+1;
        if (ballx==500) {ballx=10;}
        try { Thread.sleep(100); } catch (Exception e) {}
        repaint();
    }

  • Java.lang.NOsuch method error "main"

    I have compiled this code, but it gives me this error and I don't know how to solve it could anyone help me?
    the code is:
    package myproject;
    import java.io.*;
    import java.util.*;
    interface SharedConstants
    int NO=0;
    int YES=1;
    int MAYBE=2;
    int LATER=3;
    int SOON=4;
    int NEVER=5;
    class Principale implements SharedConstants
    Random rand = new Random();
    int ask()
    int prob = (int) (100*rand.nextDouble());
    if (prob<30)
    return NO;
    if (prob<60)
    return YES;
    if (prob<75)
    return LATER;
    if (prob<98)
    return SOON;
    else
    return NEVER;
    class AskMe implements SharedConstants
    static void answer(int result)
    switch(result)
    case NO:
    System.out.println("no");
    break;
    case YES:
    System.out.println("yes");
    break;
    case MAYBE:
    System.out.println("maybe");
    break;
    case LATER:
    System.out.println("later");
    break;
    case SOON:
    System.out.println("soon");
    break;
    case NEVER:
    System.out.println("never");
    break;
    public static void main (String[] args)
    Principale q = new Principale();
    answer(q.ask());
    answer(q.ask());
    answer(q.ask());
    answer(q.ask());
    Thanks for your help!!!!!

    Isn't it something like the class that contains the main function must be the first one in your file? I dunno if it must be before or after the interfaces and packages though.
    Even if it's not mandatory, I think it's a good thing to put the "main" class on top of the file and put all other class below. Actually, I would put only one class per file, except if the class in a child class of the "main" one.

  • Maintenance of outside main lines

    Does anyone know how a person can get ahold of someone in the U.S. at Comcast to ask when they are going to be finished with some main line upgrades in my neighborhood?   The undeground line search company placed a bunch of little yellow and red flags in my yard at the behest of Comcast and they told me Comcast was doing work on main lines and that they would be done by June 18th and a Comcast call center in Mexico told me that it would probably be a month and that Comcast would remove the flags when they were done.    It is now one day to July and the flags are still there and I cannot find anything on Comcast's website re this issue.   I am so tired of having to speak to someone overseas to get any response from Comcast for issues and then get different answers to the same question over and over again.  So, does anyone know how a person can contact Comcast via e-mail from a person's account as I would prefer to get my answers in writing so I can have a history of the subpar service that I get from Comcast!!!! 

    Hi Ravindra,
    I think this is not possible . If the stock is not available this will display in same passion.
    Regards,
    Madhu.

Maybe you are looking for

  • Why do the back/forward arrows no longer work - they are grayed out?

    When I start a new Firefox window or tab the back/forward arrows do not work and are grayed out. I can get previous sites by right click. I also get an orange "Firefox" dropdown tab in the upper left corner. It appears as though I have a Firefox wind

  • How do I record HDR Toning setups as Actions?

    I've tried to save specific setups within an Action script but while I can call the HDR Toning panel up, the settings are not remembered.

  • ISE Guest portal CWA - Webauth exit button on Login Successful page not working (Safari and Chrome)

    Hello Has anyone else experienced the issue where this exit button works when IE is used to login to the ISE Guest portal, but not when Chrome is used. Same for Safari (from IPAD). Sent from Cisco Technical Support iPad App

  • 802.1x with Switch SRW2024-Web

    Hi@all, i want to implement a port based NAC with Windows Server 2008 NPS acting as RADIUS and some Linksys/Cisco SRW2024 - WebView Switches, using EAPoL and MD5-Auth. (SRW2024: http://www.cisco.com/en/US/products/ps9989/index.html) I am able to auth

  • WdDoInit() is not called

    Hi, I am running an example from SAP WebDynpro tutorial (A Simple Input form) and I got a null value error from the checkMandatory method. The method throws the null exception beacuse a field value is NOT initialized. The initialization should have b