Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Java at school

  1. Aug 22, 2010 #1
    In school I'm in a class AP Computer Science where we learn java. In the past few weeks I have learned the basics of java which came very easy to me. Now I want to know what can I do to my programs to make them stand out? What should I strive for, least amount of lines or looks the best(we aren't learning Gui's.) Or is there something else I can strive for? Also if you have any good resources like these http://www.java2s.com/Tutorial/Java/CatalogJava.htm" [Broken] that would be greatly appreciated.

    Thank You

    Here is my latest program, which was meant to just add two numbers but I added the dashes and the quit command to make it better.

    Please enter 2 numbers for me to add

    Enter first number: 20.625
    Enter second number: 21.375

    Answer is: 42.0

    To quit press 9 or press 1 to start over: 1
    Last edited by a moderator: May 4, 2017
  2. jcsd
  3. Aug 22, 2010 #2
    Sun, now Oracle, has a good java tutorial as well:
    (Interesting, my link was actually to sun.java but it got
    mapped to oracle...what will they think of next?)

    Wikibooks has a good java book too:

    Are you assigned specific problems in the class or do you get to invent stuff yourself? If the latter, find something to do in a field that interests you, making astronomical calculations, doing astrological charts, calculating parameters for your hot-rod engine...whatever. While doing assigned homework problems, aside from consistent code formatting and good commenting, I would concentrate on elegant design and algorithms. Try to decompose the problem into a good Object Model using Abstraction, Inheritance, and Polymorphism...see the wiki article for more: http://en.wikipedia.org/wiki/Object-oriented_programming

    ps...I would change your adder program to use a "q" or some other non-numeric input instead of "9" to quit...
  4. Aug 22, 2010 #3
    Devshed is one of the better resources for coding.

    At this point in your education you should explore techniques with the technology. I am not a big fan of Java and the only reason it is widely used is because it was free. In the US free software is a big no-no, but globally developers like free tools even though you are giving away the code.

    There are legal reasons why freeware is not embraced in the US, and it only becomes acceptable once a company like Oracle buys it. That is why everywhere else in the world they scratch their heads and wonder why freeware has not boomed in the US, like it has in Europe, India, and China.

    But if you must use java, learn all of the flavors, awt, console, and jsp. Implement your code in all of them and you will learn alot.

    Learn the core classes for each data type and how the operations are inherited. Understand typing to a science.
  5. Aug 28, 2010 #4


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    I disagree with that. Many corporations and government agencies prefer to use freeware. Getting the customer to pay for software that is freely available is not an easy sell. There has to be a very good reason to not take the freeware over something that costs money but does the same thing.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook