Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: My first Java Program

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Thanked 0 Times in 0 Posts

    Default My first Java Program

    Hi, I'm currently studying my first year at a Bachelor of Computing.
    Programming & Problem solving is one of my subjects.

    Here is a riddle for you programmers:
    * Write a Java program that contains a main() method with declarations of three variables each of a different primitive type.
    * Add code to your program to prompt the user to enter a value into each of the variables. Use methods in the Scanner class to do this. Remember to let the user know what type of data is expected
    * Add code to display the values stored in each of the variables on the console.

    You guys may laugh at how simple this might be, but remember this is my first task ha!
    Any starting points/ideas/solutions would be greatly appreciated, ta.


    P.S. I'm using JCreator for writing the program.
    Last edited by Creeeds; March 15th, 2011 at 05:24 AM.

  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    United Kingdom
    My Mood
    Thanked 293 Times in 226 Posts
    Blog Entries

    Default Re: My first Java Program

    Hello Creeeds,

    This is not really a riddle
    It's a very basic program and I'm sure you will pick it up quickly.

    Take a look here - http://www.javaprogrammingforums.com...ner-class.html

    It contains the code you need to get started.

    Also read - Variables (The Java™ Tutorials > Learning the Java Language > Language Basics)

    And play with System.out.println(variableName);
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

Similar Threads

  1. java program help
    By lolalala in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 24th, 2010, 05:42 PM
  2. Help with this java program
    By Nemphiz in forum Object Oriented Programming
    Replies: 3
    Last Post: April 13th, 2010, 03:09 AM
  3. How do you add GUI to this java program?
    By leyla in forum AWT / Java Swing
    Replies: 1
    Last Post: October 18th, 2009, 01:32 PM
  4. Convert Java Program to Java ME code
    By rinchan11 in forum Java ME (Mobile Edition)
    Replies: 1
    Last Post: October 5th, 2009, 10:18 PM
  5. Java Program Help
    By javakid93 in forum Java Theory & Questions
    Replies: 6
    Last Post: July 27th, 2009, 11:03 AM