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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:53:38+00:00 2026-06-09T16:53:38+00:00

I’m very new in Java and I have a small question. I believe it

  • 0

I’m very new in Java and I have a small question. I believe it is due to some misunderstanding of the concepts.

So, I have main class menu:

/**
 * menu.java
*/
public class menu {
    public void run() {
        println ("1. Option#1.");
        println ("2. Option#2.");
        println ("============");

        int choose = readInt("Enter a choice:");
        if (choose == 1) {
        // QUESTION>>>>>   // ### how can I call class option1.java here?

    }
}


/**
 * option1.java
*/
public class option1 { 
   public void scriepedos () { 
        setFont("Times New Roman-24");
        while (true) {
                String str = readLine("Please enter a string: "); 
                if (str.equals("")) break; 
                String rev = reverseString(str); 
                println(rev);
        }
    }

    private String reverseString(String str) {
        String result = "";
        for (int i=0; i<str.length();i++){
            result=str.charAt(i)+result;
        }
        return result.toLowerCase();
    }
}

Many thanks in advance. Leo

  • 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-09T16:53:40+00:00Added an answer on June 9, 2026 at 4:53 pm

    You need an instance of option1 to call upon e.g.

    option1 o1 = new option1();
    o1.scriepedos();
    

    Alternatively you can make the method static. That means that you don’t need the corresponding instance of the object e.g. in option1.java

    public static void scriepedos () { ...
    

    then in main.java

    option1.scriepedos();
    

    The above isn’t very OO. You’re now making use of the fact that you can have an object encapsulating state etc. and is a much more procedural style.

    Notes:

    1. I suspect you need a public static void main() method to invoke the above
    2. Java style would require class names to be camel-cased. e.g. Option1, Main
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have thousands of HTML files to process using Groovy/Java and I need to
I have some data like this: 1 2 3 4 5 9 2 6
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small

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.