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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:49:16+00:00 2026-06-18T09:49:16+00:00

I’ve just started Java programming yesterday (so don’t expect too much) and I’ve written

  • 0

I’ve just started Java programming yesterday (so don’t expect too much) and I’ve written some code. My code works the way i want it to work but there is obviously things wrong with it, i was just wondering ways in which to improve it. I think I’ve added unnecessary things. I’m practicing to use classes and other stuff.

the testing.java files contains:

import java.util.Scanner;

class testing {
    private static Scanner input_sn;
    private static Scanner input_fn;
    private static Scanner input_mem;

    public static void main(String[] args){

        String First_Name;
        String Second_Name;
        int members;
        int count;


        System.out.println("Members: ");
        input_mem = new Scanner(System.in);
        members = input_mem.nextInt();

        funcs funcsObj = new funcs();

        for (count = 0; count < members; count++)
        {
            System.out.println("What is the first name? ");
            input_fn = new Scanner(System.in);
            First_Name = input_fn.nextLine();

            System.out.println("What is the second name? ");
            input_sn = new Scanner(System.in);
            Second_Name = input_sn.nextLine();

            funcsObj.names( funcsObj.setFn(First_Name), funcsObj.setSn(Second_Name));
        }   
    }
}

and my funcs.java file contains:

public class funcs
{
    private String firstName;
    private String secondName;
    private static int members = 0;

    public String setFn(String fn)
    {
        firstName = fn;
        return fn;
    }

    public String setSn(String sn)
    {
        secondName = sn;
        return sn;
    }


    public void names(String fn, String sn)
    {
        firstName = fn;
        secondName = sn;
        members++;
        System.out.printf("%d\t%s\t%s\n", members, fn, sn);
    }
}

I think most of the problems can be found in the funcs.java file.

Thanks

  • 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-18T09:49:17+00:00Added an answer on June 18, 2026 at 9:49 am

    Class names should be Capitalized. EG: ThisIsMyClassName. Field names should be camelCased. EG: thisIsAFieldName. In java, you don’t use underscores for field names. You should put the opening curly braces on the same line as the statement. EG: if ... { You can read more about these details in the java style guide:

    http://www.oracle.com/technetwork/java/javase/documentation/codeconvtoc-136057.html

    • 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 don't have much knowledge about the IPv6 protocol, so sorry if the question
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have been unable to fix a problem with Java Unicode and encoding. The

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.