none
Syntax Help needed RRS feed

  • Question

  • Hello My name is Jonathan. I am new to the developent community as i have just started learning Java.

    One of the questions in my course work reads as follows:

    Create a class called Dog. The class should have a constructor and a method called rollover(). Create a new instance from the main() method and then call the rollover() method on the instance. When a new instance is created the program should print "Bark" to the screen. When the rollover() method is called, the program should print out "Rolling Over!" to the screen. This is what i have come up with...

     

    public class Dog {

             public Dog ();

             static String rollover (); {

             }

                     public static void main (String[] args) {

                         Dog Fido = new Dog ();

                         System.out.println("Bark");

                         Fido.rollover ();

                         System.out.println("Rolling Over!");

                     }

    }

     

    Please tell me if this is correct or not?? when i compile it with the javac command in the prompt, it always returns an error!!!!

    I hope to get some feedback soon 

    Thanks again

    Monday, September 20, 2010 7:31 PM

Answers

  •  Hi,
     
    Thanks for your post here, this forum is for discussing Microsoft
    Learning/Certification questions. You probably want to ask here for
    future questions:
     
     
    or temporarily,
     
     
    You're in luck though, I know Java. Based on your question, you are
    pretty close to the correct version
     
    Dog.java:
     
    import java.io.*;
     
    public class Dog {
             public Dog () {
                      System.out.println("Bark");
             }
              public void rollover () {
                 System.out.println("Rolling Over!");
             }
              public static void main (String[] args) {
                        Dog Fido = new Dog ();
                        Fido.rollover ();
             }
    }
     
    What is the specific compiler error that you receive?
     

    -- Mike Burr
    • Edited by Mike Burr Tuesday, September 21, 2010 8:09 PM minor syntax error
    • Marked as answer by Rubel KhanModerator Thursday, October 21, 2010 2:27 PM
    Monday, September 20, 2010 10:47 PM
  • Hi Jonathan,

    It sounds like you have a really good path going. Since you are like me and still relatively early in your career (I myself am only 22 and am still finishing my education to be a CPA), you might want to consider a certification or two to help your job search. I mainly hold IT certifications (Sun Certified Systems Administrator on Solaris 10 and the MCITP EA/SA and a few misc. MCTS), but I also know that Oracle offers a few different Java certifications  (http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=141#middleware) and Microsoft offers certification in .Net development (http://www.microsoft.com/learning/en/us/certification/cert-vstudio.aspx#tab2).

    I myself am more likely to go the Microsoft path, but I think that it might be beneficial to get one or more certifications. This is especially true since many employers use computers to look at resumes and look for key words and phrases instead of reviewing each resume individually. I know that getting the EA/SA certificates helped in combination with my experience to get a position as a Windows System Administrator (and oddly enough, I am not even out of school yet).

    From my experience so far, the working world is significantly different from academia in that having a lot of things memorized is not as valuable as understanding how to look something up and how to figure something out. You are rarely constrained by 1-2 hours (typical exam times) and usually have a half day or a full day to get something worked out. I'd imagine that it would be a rare work environment that would require you to present a proof off the top of your head.

    As a final note, I'd recommend trying to get some exposure to different aspects of the software engineering process. I find that I like the architectural area a lot more than the actual coding, since it feels like it gets somewhat repetitive and I like higher level design more than designing or applying specific algorithms. What I've found in my previous job (working for my University's IT department), I learned a lot more about what I don't want to do than what I do want to do.

    Anyway, best of luck.


    -- Mike Burr
    Monday, September 27, 2010 10:26 PM

All replies

  •  Hi,
     
    Thanks for your post here, this forum is for discussing Microsoft
    Learning/Certification questions. You probably want to ask here for
    future questions:
     
     
    or temporarily,
     
     
    You're in luck though, I know Java. Based on your question, you are
    pretty close to the correct version
     
    Dog.java:
     
    import java.io.*;
     
    public class Dog {
             public Dog () {
                      System.out.println("Bark");
             }
              public void rollover () {
                 System.out.println("Rolling Over!");
             }
              public static void main (String[] args) {
                        Dog Fido = new Dog ();
                        Fido.rollover ();
             }
    }
     
    What is the specific compiler error that you receive?
     

    -- Mike Burr
    • Edited by Mike Burr Tuesday, September 21, 2010 8:09 PM minor syntax error
    • Marked as answer by Rubel KhanModerator Thursday, October 21, 2010 2:27 PM
    Monday, September 20, 2010 10:47 PM
  •  

    Hey Mike

    Thanks so much for your reply. It was very helpfull.

    Also thanks for the links, i will check them out too.

    As i mentioned i have recently started to learn programing. In my course options i had an option of C++, JAVA, Visual Basic and C# of which i had to select 2.

    I selected JAVA (obviously) and C# as the second choice (i have also completed SQL 2000 and PERL)

    In your opinion, was that a wise choice? I have the option to change the second language as i havent started with it yet or recieved any course material on it?

    Thanks again for your assistance. I look forward your reply.

    Jonathan

     

    ps. the compiler error was as follows

    Dog.java:17: cannot find symbol

    symbol : method rollover()

    location: class Dog

                                             Fido.rollover();

    1 error                                     ^

     

    Saturday, September 25, 2010 9:12 PM
  • I think this depends a lot on what your goals are, I personally am investing a lot of time around Microsoft and Cisco products and technologies.

    Before Sun and Oracle merged, I ended up getting certified as a Solaris Administrator, but now I am unsure of the direction that Oracle is going to take with technologies such as MySql, Java, and Solaris, so I have been hesitant to spend a lot of additional time on training or certification in these areas. 

    I think knowing and having experience in both is a really strong asset to have as it gives you options if one or the other companies (Microsoft or Oracle) goes bankrupt overnight, which isn't likely. Also, if you have both, you can probably handle movements in the industry as companies change vendors.

    Just out of curiosity, what are your future goals for your career?


    -- Mike Burr
    Saturday, September 25, 2010 11:58 PM
  • Hey Mike

    Thanks again for your reply. I suppose it would be advantagious to have experince in both.

    In a nut-shell, im 26. I graduated from school in 2000 and decided to travel for a year or two. Long story short, it ended up being 9 years and a bit years before i returned home and decided to further my education.

    I always had an affection for a computers/computer systems so i naturally found an instant liking in software applications and web pages etc.

    I did some reaserch on the industry and my goal was initially to learn a language that was not "too complicated" but that also offered a lot of flexability and also that would be beneficial for learning further languages in the future. And seeing as my first choice was in the sun/oracle route i decided to also select a language that was inheritantly tied to the other powerhouse in terms of mainstream; Microsoft.

    JAVA, in my current course is my 'main' or 1st language and C#, which is the 'secondary' or 2nd. In my course to date i have completed DHTML, SQL 2000, and a number of other 'units', some of which are more theory based (ie software engineering, realtional database modelling & design, processing & logic concepts etc)

    I am not typically a great mathematics student, which means i work twice as hard as the next person (although i have passed the relative aptitudes in order to pursue the study path). 

    I do find it challenging at times but i am really entusiastic about the concept of creating apps and utilities using code. The only stumbling block i find is that it is pretty tough to find employment without experience which is a redundant in itself.

     

    Thanks again for your insight and assistance. It is much appreciated.

    Regards,

    Jonathan  

     

    Sunday, September 26, 2010 11:30 AM
  • Hi Jonathan,

    It sounds like you have a really good path going. Since you are like me and still relatively early in your career (I myself am only 22 and am still finishing my education to be a CPA), you might want to consider a certification or two to help your job search. I mainly hold IT certifications (Sun Certified Systems Administrator on Solaris 10 and the MCITP EA/SA and a few misc. MCTS), but I also know that Oracle offers a few different Java certifications  (http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=141#middleware) and Microsoft offers certification in .Net development (http://www.microsoft.com/learning/en/us/certification/cert-vstudio.aspx#tab2).

    I myself am more likely to go the Microsoft path, but I think that it might be beneficial to get one or more certifications. This is especially true since many employers use computers to look at resumes and look for key words and phrases instead of reviewing each resume individually. I know that getting the EA/SA certificates helped in combination with my experience to get a position as a Windows System Administrator (and oddly enough, I am not even out of school yet).

    From my experience so far, the working world is significantly different from academia in that having a lot of things memorized is not as valuable as understanding how to look something up and how to figure something out. You are rarely constrained by 1-2 hours (typical exam times) and usually have a half day or a full day to get something worked out. I'd imagine that it would be a rare work environment that would require you to present a proof off the top of your head.

    As a final note, I'd recommend trying to get some exposure to different aspects of the software engineering process. I find that I like the architectural area a lot more than the actual coding, since it feels like it gets somewhat repetitive and I like higher level design more than designing or applying specific algorithms. What I've found in my previous job (working for my University's IT department), I learned a lot more about what I don't want to do than what I do want to do.

    Anyway, best of luck.


    -- Mike Burr
    Monday, September 27, 2010 10:26 PM