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 8757241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:15:24+00:00 2026-06-13T14:15:24+00:00

So I just started with Java a few weeks ago and I am trying

  • 0

So I just started with Java a few weeks ago and I am trying to teach myself how to make my own methods. I made a program that adds two numbers when I compile the class “ClassTest”. Here is the error:

H:\Java Things\ClassTest.java:10: error: cannot find symbol
            GetNum(int1, int2);
        ^
  symbol:   method GetNum(int,int)
  location: class ClassTest
1 error

Process completed.

Here is the code for ClassTest:

import LotsOfMethods.*;

public class ClassTest
{
    public static void main (String[] args)
    {
        int int1 = 5, int2 = 7;
        GetNum(int1, int2);
    }
}

And here is the code for ExampleMethod:

package LotsOfMethods;

public class ExampleMethod
{
    public static int GetNum(int num1, int num2)
    {
        int result;
        result = num1 + num2;
        return result;
    }
}
  • 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-13T14:15:24+00:00Added an answer on June 13, 2026 at 2:15 pm

    First, it’s important to recognize how you call a method in Java. You need to specify the object who will fulfill the method, and the name of the method that you’re calling.

    When you write:

    GetNum(int1, int2);
    

    You’re not specifying an object that will execute GetNum. Java has some default behavior to handle this case: it tries to resolve the method from the object context surrounding your code. So Java says, “I can’t find a GetNum() method belonging to this ClassTest object,” and you get the error:

    H:\Java Things\ClassTest.java:10: error: cannot find symbol
                GetNum(int1, int2);
    

    The method that you want is in the class ExampleMethod. It is a static method attached to the ExampleMethod class, which means you don’t need to instantiate a copy in order to get there. Instead, you can do:

    int result = ExampleMethod.GetNum(int1, int2);
    

    Classes with static methods provide a sort of namespace around those methods, and so the class itself provides enough data to resolve your method. If you had a non-static method, you’d need to do something like:

    ExampleMethod example = new ExampleMethod();
    int result = example.GetNum(int1, int 2);
    

    I hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started with java a few weeks ago, and am trying to make
I just started with Java servlets few days ago. I am trying to develop
I've just started learning Java (about a week ago) and the last few days
Ok so I've just started learning java (I usually program in Objective-C). My first
Just started using Java (for Android, if that matters) and all I want is
Recently started programming Android Java (Eclipse), Im trying to make a simple reader app
I just started learning java and I'm working on a program. I'm getting an
I've just started using Java's enums in my own projects (I have to use
I just started to study Java EE and made some examples (Just Hello World
I started learning c++ about 3 weeks ago after 2 years of java. It

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.