Simple code to solve

WE HAVE
int name(int i);
void name(int i);
1. what will happen when running this code in same class.?
2. what will happen when running this code(one method in super class and other in subclass)?

Try it... it won't compile for the same class.It will only come close to compiling for an interface
(the methods have no body)your eyes are pretty sharp ;)

Similar Messages

  • What's wrong with this simple code?

    What's wrong with this simple code? Complier points out that
    1. a '{' is expected at line6;
    2. Statement expected at the line which PI is declared;
    3. Type expected at "System.out.println("Demostrating PI");"
    However, I can't figure out them. Please help. Thanks.
    Here is the code:
    import java.util.*;
    public class DebugTwo3
    // This class demonstrates some math methods
    public static void main(String args[])
              public static final double PI = 3.14159;
              double radius = 2.00;
              double area;
              double roundArea;
              System.out.println("Demonstrating PI");
              area = PI * radius * radius;
              System.out.println("area is " + area);
              roundArea = Math.round(area);
              System.out.println("Rounded area is " + roundArea);

    Change your code to this:
    import java.util.*;
    public class DebugTwo3
         public static final double PI = 3.14159;
         public static void main(String args[])
              double radius = 2.00;
              double area;
              double roundArea;
              System.out.println("Demonstrating PI");
              area = PI * radius * radius;
              System.out.println("area is " + area);
              roundArea = Math.round(area);
              System.out.println("Rounded area is " + roundArea);
    Klint

  • A simple problem to solve... I hope.

    $A simple problem to solve... I hope. Hi Guys,
    This is my first post on this forum, and I'm hoping that the problem I'm encountering at the moment is down to my own stupidity rather than technical issues.
    Firstly, I should mention that I have used my X-fi sound blaster xtreme audio card for months now in my old PC which was running XP 32 bit with no problems whatsoever. In the last day I've built a new PC which has the following specs:
    Intel I7 860
    tb HDD
    4gb Ram
    Windows 7 Ultimate 64
    Nvidia GTX280
    Sound was very quiet and of a fairly poor quality to begin with, and I soon realised that I hadn't installed any drivers for the soundcard, so I went ahead and did so. Following this, I enter a **bleep**storm of illogical proportions which to me makes absolutely no sense.
    I get no sound from my speakers or headphones whatsoever. I have a pair of M-Audio AV-40 monitors at the moment, and no matter what I try, I can't get sound to work. When I go to the mixer, it seems odd to me
    http://yfrog.com/7fxfiproblemj
    I thought that there would be options for Line Outs etc, but I may be wrong.
    I've run the diagnostic tests and everything comes back absolutely fine.
    The weirdest thing however is the fact that when I test the speaker configuration, it responds to nothing except from the 7. surround sound, and my speakers react to the bottom left and bottom right speakers. I've tried installing, re-installing drivers no end. Looked for fixes and checked google as well and found nothing that matches the description of my problem.
    Am I missing out on something really obvious here? Or is there a more technical underlying factor ?behind this issue.
    Any help is hugely appreciated, thanks?

    Thanks for all of you help, but I still don't think the problem's solved.
    Here's the problem explained more thouroloy. I have a java program that uses lots of jar files. That means that to run my program, I need to have the CLASSPATH set to pick up all of these jar files. I'd also like to be able to give someone a copy of this program on a cd and have them immediately run it without having to assume anything about their configuration (except that they have java installed).
    So what I did was create a batch file that (at least temporarily) sets up the CLASSPATH to meet my needs. It then calls "java myProgram <all the other parms...>".
    Things run fine, except that the command window that gets opened up stays around while Swing program runs, and doesn't close until I close the Swing program. I'd like that that didn't happen.
    -- echo off
    Not going to do anything to help. It will stop the batch commands from echoing, but that's about it.
    -- javaw
    I tried this and it also doesn't work. It seems that neither java nor javaw return until after the program that it is running actually end.
    -- Executable jar
    Sounds promising, but will it work? How do I make sure the CLASSPATH is properly set before running this?
    Thanks again for all of your hlep.
    Sander Smith

  • Convert simple code from as2 to as3

    Hello, i am looking for some help here for something simple (i think)
    var txt:String = link1;
    btn.onRelease = function():Void {
    if( sample_id )
    getURL("http://www.website.com/registration?partner_id=" + sample_id + "sampleURLCode", "_blank");
    else
    getURL("http://www.website.com/registration?sampleURLCode", "_blank");
    Is there a way to make this simple code into AS3?

    Hi, Apparantly that's because the 'link1' and 'sample_id' variables are not within the scope of the code you posted above, Perhaps you have defined them outside on a different frame or class. You can either define them with the same code like:
    var sample_id:Number=1234;  //Use your own variable type and value here
    var link1:String = "your string or link URL here";
    var txt:String = link1;
    btn.addEventListener(MouseEvent.CLICK, gotoURL);
    function gotoURL(e:MouseEvent)
    if( sample_id )
          navigateToURL(new URLRequest("http://www.website.com/registration?sample_id=" + sample_id + "sampleURLCode"),"_blank");
    else
          navigateToURL(new URLRequest("http://www.website.com/registration?sampleURLCode"),"_blank");
    Or you can put a direct reference to your existing variable like (If your variables are defined on root/frame 1) :
    var link1:String = "your string or link URL here";
    var txt:String = MovieClip(this.root).link1;
    btn.addEventListener(MouseEvent.CLICK, gotoURL);
    function gotoURL(e:MouseEvent)
    if( MovieClip(this.root).sample_id )
          navigateToURL(new URLRequest("http://www.website.com/registration?sample_id=" + sample_id + "sampleURLCode"),"_blank");
    else
          navigateToURL(new URLRequest("http://www.website.com/registration?sampleURLCode"),"_blank");
    try that, or you can share your .fla !
    cheers

  • Simple code to send ALV display as XLS attachment  to SAP inbox

    Hi All,
    Simple code to send ALV display as XLS attachment  to SAP inbox.
    Also i need to send only 200 records per attachement. So in this case i need send multiple attachment per mail
    Thanks,
    Lokesh

    The following code is used to send the internal table which u pass fo  the ALV display to be send as excel sheet attachment
    Internal table is it_attach[]
    ld_email               = po_email.
      ld_mtitle              = 'Email From Z377_EMAIL_XLS'.
      ld_format              = 'XLS'.
      ld_attdescription      = 'filename'.
      ld_attfilename         = 'Allot'.
      ld_sender_address      = ' '.
      ld_sender_address_type = ' '.
    * Fill the document data.
      w_doc_data-doc_size = 1.
    * Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    * Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
      ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    * Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE li_content LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    * Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    * Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
      EXPORTING
      document_data              = w_doc_data
      put_in_outbox              = 'X'
      sender_address             = ld_sender_address
      sender_address_type        = ld_sender_address_type
      commit_work                = 'X'
    *IMPORTING
    *sent_to_all                = w_sent_all
      TABLES
      packing_list               = t_packing_list
      contents_bin               = t_attachment
      contents_txt               = li_content
      receivers                  = t_receivers
      EXCEPTIONS
      too_many_receivers         = 1
      document_not_sent          = 2
      document_type_not_exist    = 3
      operation_no_authorization = 4
      parameter_error            = 5
      x_error                    = 6
      enqueue_error              = 7
      OTHERS                     = 8.

  • Jmf simple code

    Hi all,
    this is my simple code that plays a video from a specifed location.
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package javaapplication1;
    * @author rohan
    import com.sun.media.util.ContentType;
    import javax.media.*;
    import javax.media.Manager;
    import java.io.*;
    import java.net.URL;
    import javax.media.bean.playerbean.MediaPlayer;
    import java.awt.*;
    import java.net.ProtocolException;
    import javax.swing.*;
    public class Main extends JFrame{
    * @param args the command line arguments
    public Main()
    try
    Manager.setHint( Manager.LIGHTWEIGHT_RENDERER, true );
    Container cont=getContentPane();
    cont.setLayout(new FlowLayout());
    String myUrl=new String("C:\\Users\\rohan\\Softwares\\Jmf and jain sip\\Fig21_06_07\\bailey.mpg");
    System.out.println("myUrl====="+myUrl);
    MediaLocator myurls =new MediaLocator(myUrl);
    Player myplayer=Manager.createRealizedPlayer(myurls);
    System.out.println("Rohan");
    Component video = myplayer.getVisualComponent();
    cont.add(video);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    myplayer.start();
    catch(Exception e)
    System.out.println("Exception====="+e);
    public static void main(String[] args) {
    // TODO code application logic here
    // JFrame fr=new JFrame("hello");
    Main obj=new Main();
    obj.setBounds(300, 300 , 300, 300);
    obj.setVisible(true);
    Problem here is i get this exception
    "Exception=====javax.media.NoPlayerException: Cannot find a Player for :C:\Users\rohan\Softwares\Jmf and jain sip\Fig21_06_07\bailey.mpg
    Can u plz tel me where do i make changes ,so that i can run this simple app. Plz help me...so that i can go further(plz this is my first jmf app.)
    thanks.

    Change your file path like +"file:/C:/delta.mpg"+.
    Hope this will help you to fix your issue.
    Cheers,
    ARIF

  • Anyone have Simple Code to Play an .Flv file on a Website?

    Hi,
    Can someone please tell me how to make a web page play a .flv file. 
    Simple, basic code would do.
    I have an .flv file uploaded on my website.
    How do I get the Flash Player to play the file when someone visits the page?
    Again, all I'm looking for is simple code.
    Thanks,
    Joe

    add an flvplayback component to your swf.  give it an instance name (say flv).  then use:
    flv.contentPath="yourflv.flv";   // for as2
    flv.source="yourflv.flv";  // for as3

  • Ask for help( simple code but wired error )!

    The post I sent just now has some mistakes. This post is correct. My simple code is as follows:
    import java.io.*;
    import java.net.*;
    public class count {
    float dclient = (float)3.333;
    float dlan = (float)0.01884;
    float drouter = (float)0.00115;
    float doutlink = (float)0.04185;
    float dinternet = (float)1.2615;
    float dinlink = (float)3.18129;
    float client1 = 0;
    float lan1 = 0;
    float router1 = 0;
    float outlink1 = 0;
    float internet1 = 0;
    float inlink1 = 0;
    float client2 = 0;
    float lan2 = 0;
    float router2 = 0;
    float outlink2 = 0;
    float internet2 = 0;
    float inlink2 = 0;
    float x = 0;
    float z = (float)3.333;
    public static void main(String[] args) {
    for (int n=1; n<16; ++n)
    client1 = dclient;
    lan1 = dlan * (1+lan2);
    router1 = drouter;
    outlink1 = doutlink * (1+outlink2);
    internet1 = dinternet;
    inlink1 = dinlink * (1+inlink2);
    x = n / (z + client1 + lan1 + router1 + outlink1 + internet1 + inlink1);
    client2 = x * client1;
    lan2 = x * lan1;
    rounter2 = x * rounter1;
    outlink2 = x * outlink1;
    internet2 = x * internet1;
    inlink2 = x * inlink1;
    System.out.println(client1 + " " +
    lan1 + " " +
    rounter1 + " " +
    outlink1 + " " +
    internet1+ " " +
    inlink1+ " **** " +
    x + " **** " +
    client2 + " " +
    lan2 + " " +
    rounter2 + " " +
    outlink2 + " " +
    internet2+ " " +
    inlink2 + " ********************end of n = " + n + "************************"
    The compiling error is:
    count.java:43: Can't make a static reference to nonstatic variable dclient in class count.
    client1 = dclient;
    ^
    1 error
    What is wrong with it? Many thanks!

    import java.io.*;
    import java.net.*;
    public class count
         public static float dclient = (float)3.333;
         public static float dlan = (float)0.01884;
         public static float drouter = (float)0.00115;
         public static float doutlink = (float)0.04185;
         public static float dinternet = (float)1.2615;
         public static float dinlink = (float)3.18129;
         public static float client1 = 0;
         public static float lan1 = 0;
         public static float router1 = 0;
         public static float outlink1 = 0;
         public static float internet1 = 0;
         public static float inlink1 = 0;
         public static float client2 = 0;
         public static float lan2 = 0;
         public static float router2 = 0;
         public static float outlink2 = 0;
         public static float internet2 = 0;
         public static float inlink2 = 0;
         public static float x = 0;
         public static float z = (float)3.333;
         public static void main(String[] args)
              for (int n=1; n<16; ++n)
                   client1 = dclient;
                   lan1 = dlan * (1+lan2);
                   router1 = drouter;
                   outlink1 = doutlink * (1+outlink2);
                   internet1 = dinternet;
                   inlink1 = dinlink * (1+inlink2);
                   x = n / (z + client1 + lan1 + router1 + outlink1 + internet1 + inlink1);
                   client2 = x * client1;
                   lan2 = x * lan1;
                   router2 = x * router1;
                   outlink2 = x * outlink1;
                   internet2 = x * internet1;
                   inlink2 = x * inlink1;
                   System.out.println(client1 + " " +     lan1 + " " router1 " " outlink1 " " internet1 " " inlink1 " **** " +     x + " **** " +
                   client2 + " " +
                   lan2 + " " +
                   router2 + " " +
                   outlink2 + " " +
                   internet2+ " " +
                   inlink2 + " ********************end of n = " + n + "************************"

  • Data Binding: Simple code does not work.

    hi... the following simple code is used to display the ename field for a record selected in scott.emp on the console. the code is placed in an event handler. it is as follows:
    DCBindingContainer bindings = ctx.getBindingContainer();
    DCControlBinding binding = bindings.findCtrlBinding("ename");
    String Name = (binding != null) ? binding.toString() : "";
    System.out.println(Name);
    is the code above correct????
    if so, why it does not work???
    thanks for every help in advance & best regards.

    Hi,
    please check the UIModel.xml file for the page if the binding name is "name". The code you have is the same code we published in our QBE workshop and it works there. The only difference is the name of the control binding. So please check if the binding name exists. (e.g. it could be ename1 instead of ename)
    Frank

  • What's the simple code for this?

    Hello, I know it is a very simple code but what is the code if I want to have different properties for headings and such in different id's. For example I want ID "sidebar"'s headings to be aligned in the center but I want ID "main-body"'s headings to be aligned to the left. How would I go about doing that?
    Thanks!

    CSS:
    body {
    text-align:left;
    #sidebar h1,
    #sidebar h2,
    #sidebar h3,
    #sidebar h4 {text-align:center}
    /**re-usable classes**/
    .center {text-align:center}
    .right {text-align:right}
    HTML:
    <div id="main_body">
         <h1>This is left aligned by default</h1>
         <h2 class="right">This is right aligned by virtue of the class .right.</h2>
    </div>
    Nancy O.

  • XML simple code help

    Hello Everyone, I am learning XML and I'm trying to make a simple code that will display three different messages on a separate line. I already have the code but there is something that does not let it work. Please if somebody can take a quick look at the code and tell me what should I do in order to get it working. Thanks in advance
    This is my simplerequestdata.xml
    {<root>
    <message1>This</message1>
    <message2>Technology</message2>
    <message3>Is confusing</message3>
    </root>}
    This is my xmlrequest.html code
    {<html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type="text/javascript">
    var req=null;
    function xhr(){
    try
    { // Firefox, Opera 8.0+, Safari
    req=new XMLHttpRequest();
    catch (e)
    // Internet Explorer
    try
    req=new ActiveXObject("Msxml2.XMLHTTP");
    catch (e)
    req=new ActiveXObject("Microsoft.XMLHTTP");
    return req;
    function getData(){
    req = new xhr();
    req.open("get","simpleRequestData.xml");
    req.send(null);
    if(req.readyState==4){
    if(req.status==200){
    var doc = req.responseXML;
    var msgNodes = doc.documentElement.getElementsByTagName('message');
    var msgDiv = document.getElementById("message");
    var msg = document.createElement("message");
    msg.innerHTML = msgNodes[0].firstChild.nodeValue + "<br />" + msgNodes[1].firstChild.nodeValue + '
    ' + msgNodes[2].firstChild.nodeValue;
    msgDiv.innerHTML = '';
    msgDiv.appendChild(msg);
    </script>
    <style>
    #message{color:red;}
    message{display:block;color:green;}
    </style>
    </head>
    <body>
    <form>
    <input type="button" onclick="getData()" value="Get Message"/>
    <div id="message">Message Goes Here</div>
    </form>
    </body>
    </html>
    }

    That looks like Javascript to me. This forum is about Java and XML, not Javascript and XML. However the error is pretty obvious:
    var msgNodes = doc.documentElement.getElementsByTagName('message');You don't have any elements named "message" in that XML document. You have an element named "message1" and an element named "message2" and an element named "message3", but no "message" elements. So you get a list of zero elements there. You need to rewrite your DOM-handling code to reflect the actual input.

  • How to sort a list of strings, without methods and stuff just simple code?

    Hi
    How to sort a list of strings, without methods and stuff just simple code?
    Thanks in adavance!!

    Without methods? How are you going to all the sort code? What is the point of code?
    Collections.sort(List) will sort strings or anything that implements the Comparable interface, or you can use the sort method that takes a Comparator implemenation.
    If you want "just code", you could either get the Collections class souce and follow it to the code. But otherwise, there isn't one set of code. There are various sorting algorithms with advantages and disadvantages. Maybe you'd be better off searching for sorting algorithms and if you understand them, it should be simple to write Java implementations of them.

  • Need help in simple code for LayeredPane

    Hi,
    here is my simple code for displaying layered pane,
    why is it not working, when i comment label.setBounds();
    also is there a way to have a transparent layer, like
    what i want to do it
    have ont JPanel with some painting on it
    then i want to add one more JPanel over it which is transparent
    Ashish
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.awt.event.*;
    public class TestLayeredPaneFrame extends JFrame
         public TestLayeredPaneFrame()
              super("layered pane");
              this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              JLayeredPane layeredPane =new JLayeredPane();
              layeredPane.setPreferredSize(new Dimension(400,600));
    int x = 30;
    int y = 30;
    for (int i = 0; i < 3; i++) {
    x +=30;
    y +=30;
    origin.x += offset;
    origin.y += offset;
    layeredPane.add(new myLabel(x ,y ), new Integer(i));
              Container contentPane = this.getContentPane();
              contentPane.add(layeredPane, BorderLayout.CENTER);
              JPanel panel = myGlassPane();
              this.setGlassPane(panel);
              setSize(new Dimension(800,600));
              this.setVisible(true);
         private JLabel myLabel(int x, int y)
         JLabel label = new JLabel("My Name");
    label.setVerticalAlignment(JLabel.TOP);
    label.setHorizontalAlignment(JLabel.CENTER);
    label.setOpaque(true);
    label.setBackground(Color.BLUE);
    label.setForeground(Color.black);
    label.setBorder(BorderFactory.createLineBorder(Color.black));
    label.setBounds(x, y, 140, 140);     
    return label;     
         public static void main(String args[])
    TestLayeredPaneFrame tlp = new TestLayeredPaneFrame();
    }     

    Hi,
    here is my simple code for displaying layered pane,
    why is it not working, when i comment label.setBounds();
    also is there a way to have a transparent layer, like
    what i want to do it
    have ont JPanel with some painting on it
    then i want to add one more JPanel over it which is transparent
    Ashish
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.awt.event.*;
    public class TestLayeredPaneFrame extends JFrame
         public TestLayeredPaneFrame()
              super("layered pane");
              this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              JLayeredPane layeredPane =new JLayeredPane();
              layeredPane.setPreferredSize(new Dimension(400,600));
    int x = 30;
    int y = 30;
    for (int i = 0; i < 3; i++) {
    x +=30;
    y +=30;
    origin.x += offset;
    origin.y += offset;
    layeredPane.add(new myLabel(x ,y ), new Integer(i));
              Container contentPane = this.getContentPane();
              contentPane.add(layeredPane, BorderLayout.CENTER);
              JPanel panel = myGlassPane();
              this.setGlassPane(panel);
              setSize(new Dimension(800,600));
              this.setVisible(true);
         private JLabel myLabel(int x, int y)
         JLabel label = new JLabel("My Name");
    label.setVerticalAlignment(JLabel.TOP);
    label.setHorizontalAlignment(JLabel.CENTER);
    label.setOpaque(true);
    label.setBackground(Color.BLUE);
    label.setForeground(Color.black);
    label.setBorder(BorderFactory.createLineBorder(Color.black));
    label.setBounds(x, y, 140, 140);     
    return label;     
         public static void main(String args[])
    TestLayeredPaneFrame tlp = new TestLayeredPaneFrame();
    }     

  • Still having probs running simple code in SE8

    I copied a very simple code into SE8 and compiled it. Please find folowing the code and the output:
    package average2;
        import java.text.DecimalFormat;
        import java.swing.JOptionPane;
    public class Main {
        public Main() {
        public static void main( String args[] )
                int total;          // sum of grades
                int gradeCounter;   // number of grades entered
                int grade;          // grade value
                double average;     // number with decimal point for average
                String gradeString; // grade typed by user
                // initialisation
                total = 0;          // initialise total
                gradeCounter = 0;   // initialise gradeCounter
                // processing phase
                // get first grade from user
                gradeString = JOptionPane.showInputDialogue( "Enter Student Grade or -1 to Quit:" );
                // convert gradeString to int
                grade = Integer.parseInt( gradeString );
                // loop until sentinal value is reached
                while ( grade != -1 ) {
                    total = total + grade;          // add grade to tatal
                gradeCounter = gradeCounter + 1;    // increment counter
                // get next grade from user
                gradeString = JOptionPane.showInputDialogue( "Enter Student Grade or -1 to Quit:" );
                // convert gradeStrin to int
                grade = Integer.parseInt( gradeString );
            }   // end while
                // termination phase
                DecimalFormat twoDigits = new DecimalFormat( "0.00" );
                // if user entered at leat one grade...
                if( gradeCounter != 0 ) {
                    // calculate average of all grades entered
                    average = (double) total / gradeCounter;
                    // display average with two digits of precision
                    JOptionPane.showMessageDialog( null, "Class average is "
                            + twoDigits.format( average ), "Class Average",
                            JOptionPane.INFORMATION_MESSAGE );
                } // end 'if' part of if...else
                else // if no grades entered, output appropriate message
                    JOptionPane.showMessageDialog( null, "No grades were entered",
                            "Class Average", JOptionPane.cINFORMATION_MESSAGE );
                System.exit( 0 );
        } // end main
        }  // end class averageHere is the resulting output:
    init:
    deps-jar:
    Compiling 1 source file to C:\Java\Average2\build\classes
    C:\Java\Average2\src\average2\Main.java:10: illegal start of expression
    public static void main( String args[] )
    C:\Java\Average2\src\average2\Main.java:73: ';' expected
    } // end main
    C:\Java\Average2\src\average2\Main.java:75: '}' expected
    } // end class average
    3 errors
    BUILD FAILED (total time: 2 seconds).
    Can anyone tell me what I'm doing wrong?
    Thanks in advance

    Hmmm, I put the } in at the end of the code and that got rid of one of the bugs. code now reads:
    package average2;
        import java.text.DecimalFormat;
        import java.swing.JOptionPane;
    public class Main {
        public Main() {
        public static void main( String args[] )
                int total;          // sum of grades
                int gradeCounter;   // number of grades entered
                int grade;          // grade value
                double average;     // number with decimal point for average
                String gradeString; // grade typed by user
                // initialisation
                total = 0;          // initialise total
                gradeCounter = 0;   // initialise gradeCounter
                // processing phase
                // get first grade from user
                gradeString = JOptionPane.showInputDialog( "Enter Student Grade or -1 to Quit:" );
                // convert gradeString to int
                grade = Integer.parseInt( gradeString );
                // loop until sentinal value is reached
                while ( grade != -1 ) {
                    total = total + grade;          // add grade to tatal
                gradeCounter = gradeCounter + 1;    // increment counter
                // get next grade from user
                gradeString = JOptionPane.showInputDialog( "Enter Student Grade or -1 to Quit:" );
                // convert gradeStrin to int
                grade = Integer.parseInt( gradeString );
            }   // end while
                // termination phase
                DecimalFormat twoDigits = new DecimalFormat( "0.00" );
                // if user entered at leat one grade...
                if( gradeCounter != 0 ) {
                    // calculate average of all grades entered
                    average = (double) total / gradeCounter;
                    // display average with two digits of precision
                    JOptionPane.showMessageDialog( null, "Class average is "
                            + twoDigits.format( average ), "Class Average",
                            JOptionPane.INFORMATION_MESSAGE );
                } // end 'if' part of if...else
                else // if no grades entered, output appropriate message
                    JOptionPane.showMessageDialog( null, "No grades were entered",
                            "Class Average", JOptionPane.INFORMATION_MESSAGE );
                System.exit( 0 );
        } // end void main
        } // end main
    //} // end class mainWith the following output:
    init:
    deps-jar:
    Compiling 1 source file to C:\Java\Average2\build\classes
    C:\Java\Average2\src\average2\Main.java:10: illegal start of expression
    public static void main( String args[] )
    C:\Java\Average2\src\average2\Main.java:73: ';' expected
    } // end void main
    2 errors
    BUILD FAILED (total time: 0 seconds)
    I'm really sorry for being stupid. I'm just trying to understand what is going wrong. As soon as I get this sorted I can apply the principle to all other code I'm trying to write. I copied this code directly from my textbook used the SDK. Netbeans dosen't seem to like the way the textbook writes the code!

  • Simple code in VB6 to control Chroma AC power supplier throigh GPIB

    Hi there,
    I am a totally newbie in VB6 (just have a little background in C).
    Anyways, I want to write a simple code in VB6 to send commands out through GPIB to control a chroma AC power supplier. Can anyone show me how?
    thanks.

    Make sure to select Example option while installing. Your install dialog may differ due to version different.

Maybe you are looking for

  • Xcelsius error: Unable to load URL while using QAAWS on XI 3.0.

    Hi Experts, I am getting "unable to load url" in xcelsius 2008 while importing a qaaws url. After all the testing below are my observations:- 1) This has something to do with QAAWS. 2) When I logged into QAAWS and tried accessing the newly created ur

  • Unable to successfully install iTunes and play music

    I have been using iTunes in Windows for over a year and I regularly update the program, when the option pops up. I have never had a problem until now and am completely unhappy. In February (I know this was so long ago, but I've tried everything and c

  • ABAP OO: Create data

    Hello, I'am experiencing some problems with a Z-Class. I want to read data from HR-Infotypes. Normaly you can use log. database PNP, macro PROVIDE, GET PERNR and so on. This you can not use in a class (if there is a way, I would be happy to know how)

  • Problem syncing iPod Classic with iTunes

    A couple of days ago I purchased several albums from iTunes, but none of the songs will sync with my iPod Classic.  I just purchased some other songs, and they synced fine.  I have the current version of itunes and have never had this problem before.

  • ERROR in ADD-ON conflict phase while upgrading ECC 6.0 system

    Hi all, I am having ECC 6.0 system and am upgrading its SAP-APPL component to 603 patch level 03. I was having SAP-APPL 603 but at patch level 0, i checked for all dependencies and defined the queue in SPAM and it showed all green (OK) for SAP-APPL a