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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:09:41+00:00 2026-05-30T09:09:41+00:00

I have been working with android for a few years now, not once have

  • 0

I have been working with android for a few years now, not once have I had a teacher or anyone to tell me what to do.
This whole time I have wondered to myself this.

When you have a method I generally see…

public void method(){
//Stuff
}

or

private void method(){
//stuff
}

I know that a void is a method with no return value, and that public is the visibility of the method in a way but would it matter if I just used something like this…

void method(){
//stuff
}

Because then the methods visibility would just be default anyway?

I have no idea if I am right or not, is it just good practice to specify “public” or “private” ?

  • 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-05-30T09:09:42+00:00Added an answer on May 30, 2026 at 9:09 am

    Not specifying anything has a specific meaning:

    • public – any class can access this member
    • protected – subclasses can access this member (as well as code in the same class or in the same package)
    • private – only code in the same class can access this member
    • nothing (“default” access) – only code in the same package can access this member

    Arguably the last case should have had its own keyword, but we’re stuck with it now. Unless you really mean to use default visibility, it’s poor form to not specify anything – did you really need package visibility for some reason, or did you just default to package visibility for everything? Best practice is to explicitly use private for non-public members unless you need one of the others.

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

Sidebar

Related Questions

I have been working as a native C++ programmer for last few years. Now
I have been working with eclipse and android for a few months now and
I have been working on Android for a few months. Now i want to
I have been working with Java and Xml for a few months now, and
I have been writing this Android application for the past few days and everything
I have been working in android for past few months. The problem for me
Okay so i have been working on this app for a couple months now
I have only been working with android app development for a few days so
From the past few days, I have been working on an Android code to
We have been working with CVS for years, and frequently find it useful to

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.