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.


>> REGISTER NOW TO START POSTING


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

Results 1 to 8 of 8

Thread: very beginner - very simple code but.....

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    6
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Lightbulb very beginner - very simple code but.....

    hello all

    i am just started with java
    i have coding with some other PLs but i dont know why this simple code is wrong or there is a problem with the eclipse

    public class sky {
    	public static void main(String[] args) {
     
    		for(int i=0; i<5; i++){
    			System.out.printf("this is the exact %d", i);
    		}
    	}
    }

    where is the problem ??????????
    Last edited by neoanderson; September 19th, 2014 at 03:36 PM.


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: very beginner - very simple code but.....

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

    Please post your code correctly using code or highlight tags per the above link.

    If you're getting error messages, either from the compiler or while running, post the complete text of those messages. If no messages or you can't even get that far, then explain why you think there's a problem, ask specific questions.

  3. The Following User Says Thank You to GregBrannon For This Useful Post:

    neoanderson (September 19th, 2014)

  4. #3
    Member
    Join Date
    Aug 2013
    Posts
    95
    Thanks
    3
    Thanked 14 Times in 14 Posts

    Default Re: very beginner - very simple code but.....

    It works for me. What errors are you getting? probably to do with your IDE or something.

  5. The Following User Says Thank You to camel-man For This Useful Post:

    neoanderson (September 19th, 2014)

  6. #4
    Junior Member
    Join Date
    Sep 2014
    Posts
    6
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Re: very beginner - very simple code but.....

    thanks all for respond
    @camel-man do you how could i fix the Eclipse . do you think of any specific setting ?

  7. #5
    Member
    Join Date
    Aug 2013
    Posts
    95
    Thanks
    3
    Thanked 14 Times in 14 Posts

    Default Re: very beginner - very simple code but.....

    Not sure what error you are getting. What does it say when you try to run the program?

  8. The Following User Says Thank You to camel-man For This Useful Post:

    neoanderson (September 19th, 2014)

  9. #6
    Junior Member
    Join Date
    Sep 2014
    Posts
    6
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Re: very beginner - very simple code but.....

    ooh sorry i forgot to copy the error

    this is the error:

    Exception in thread "main" java.lang.Error: Unresolved compilation problem:
    The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, int)

    at alijon.main(alijon.java:7)

  10. #7
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: very beginner - very simple code but.....

    Check this link for possible solutions. Remember, Google is your friend.

  11. #8
    Junior Member
    Join Date
    Sep 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: very beginner - very simple code but.....

    Hi neoanderson !
    you can check your java file name and name of class. file name of java must be the same name of class
    Quote Originally Posted by neoanderson View Post
    hello all

    i am just started with java
    i have coding with some other PLs but i dont know why this simple code is wrong or there is a problem with the eclipse

    public class sky {
    	public static void main(String[] args) {
     
    		for(int i=0; i<5; i++){
    			System.out.printf("this is the exact %d", i);
    		}
    	}
    }

    where is the problem ??????????

Similar Threads

  1. I dont see anything wrong with this(simple beginner code)
    By Olympaphibian89 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: September 26th, 2012, 03:11 PM
  2. beginner needs help with simple problem
    By ddonn in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 21st, 2011, 11:16 AM
  3. [SOLVED] Simple question from a beginner
    By jimmylee7706 in forum Java Theory & Questions
    Replies: 1
    Last Post: March 6th, 2011, 09:57 PM
  4. beginner and need simple help. please!
    By alal12 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: December 19th, 2010, 05:38 PM
  5. Beginner needs help with simple java assignment.
    By joachim89 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: January 6th, 2010, 07:53 PM