Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8506453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:35:42+00:00 2026-06-11T02:35:42+00:00

I am learning Java in Eclipse IDE. I cannot figure out how to get

  • 0

I am learning Java in Eclipse IDE. I cannot figure out how to get the printf to work or to define it. I have checked and I am using the correct compiler for the Java I have which is 1.6. This is the error I am getting:

Syntax error on token ".", ; expected
The method printf(String, int) is undefined for the type Addition

The program:

// Fig 2.7: Addition.java
// Addition program that displays the sum of two numbers.
import java.util.Scanner; // program uses class Scanner

public class Addition
{
// main method begins execution of Java application
public static void main( String[] args )
{
    // create a Scanner to obtain input from the command window
    Scanner input = new Scanner( System.in );

    int number1; // first number to add
    int number2; // second number to add
    int sum; // sum of number1 and number2

    System.out.print( "Enter first integer: "); // prompt
    number1 = input.nextInt(); // read first number from user

    System.out.print( "Enter second integer: "); // prompt
    number2 = input.nextInt(); // read second number from user

    sum = number1 + number2; // add numbers, then store total in sum

    System out.println( "Sum is %d\n", sum ); // display sum        

} // end method main
} // end class Addition

I’ve tried the auto-fix from Eclipse but it will still give me the error on token “.”.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T02:35:44+00:00Added an answer on June 11, 2026 at 2:35 am

    You’re missing a .:

    System out.println( "Sum is %d\n", sum ); // display sum        
    

    Should be:

    System.out.println( "Sum is %d\n", sum ); // display sum        
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've downloaded the JAVA Eclipse IDE and started learning Java. I have a good
I'm a Java developer learning C++. I'm using eclipse as my IDE and MinGW
I am learning Java with Swing and I have some problems with using JTextField
I am learning Java using Eclipse - started a project with javax.swing and could
I am just starting out learning Java, GAE etc. I have started a project
Forgive my ignorance - still learning here. I am using Eclipse Ganymede (Java 1.5)
I am using eclipse and learning android out of a book. I am copying
I have already installed eclipse for java/j2ee. For learning purposes, I want some database
I'm planning on learning Java, I have experience programming in other Object Oriented languages,
I'm learning Java and as I know only abstract classes and interfaces cannot be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.