Questions tagged [public-method]

A public method is a method declaration that allows access from other classes external to the current class.

A public method is a method declaration that allows access from other classes external to the current class. Public methods are used in many Object-Oriented programming languages including Java, C#, and Objective-C

From http://www.javabeginner.com/learn-java/introduction-to-java-access-modifiers

Fields, methods and constructors declared public (least restrictive) within a public class are visible to any class in the Java program, whether these classes are in the same package or in another package.

184 questions
0
votes
1 answer

Why do public methods require logging calls?

I made a public class AlertDialogManager as shown below, public class AlertDialogManager { /** * Function to display simple Alert Dialog * @param context - application context * @param title - alert dialog title * @param message - alert…
Aditya P
  • 1,024
  • 11
  • 10
0
votes
1 answer

How to call public function within the file in Java?

I tried to change the picture in this code. I tried to call the public function, and able to load when I want to call them out. I wanted to know how to do this, so that way I can put them in the if statement, while loop, or case statement. In this…
user2865035
  • 5
  • 1
  • 2
0
votes
1 answer

Removing Event Listeners in a Function that were started in another function

So I have been working revamping a simple guessing game that I made in my earlier years of school. Basically I have it mostly figured out, but there is something that I seem to always be missing and that is removing eventlisteners and timers at the…
David J. Davis
  • 906
  • 7
  • 20
0
votes
2 answers

Java can't use public method from one package in the another

In the same project I have two packages, 1st package contains a class with this code: package com.ginger; public class SimplePrint { public SimplePrint(){} public static void print(Object obj) { System.out.println(obj); …
Victor G
  • 5
  • 2
  • 4
0
votes
4 answers

Make a list of private variables changeable through a public function in C++

I have about 20 private bools within a class in C++. I would like for these to be publicly accessible using a (public) function. Is it possible to pass the name of a (private) variable as an argument to such a function? For example, void…
chrisb2244
  • 2,940
  • 22
  • 44
0
votes
2 answers

How to see java external jars public functions/methods in eclipse

How can i see all the public functions that are in external jars with eclipse? I have a bukkit(a minecraft server) jar. I know there are bunch of functions, but i only know one. How can i find out all the others? (Incase you didnt follow me. I am…
0
votes
1 answer

error when attempt to use equals method

If two employee objects are the same, then I want to check if the same number is returned by the "getID()" method. I think I'm using the equals method wrong. I think something is wrong with the last line of code: I have to keep this code: public…
user2932
  • 137
  • 3
0
votes
2 answers

public function in class doesn't work properly

I have a "movie" class and a public function getName(), but the function doesn't return anything, and the logcat is just blank. public class movie { public String name45; int dvd_no ; public void addData( String name1 , int dvd_no1) …
Fawzinov
  • 569
  • 2
  • 9
  • 25
0
votes
1 answer

Exercise 115; should I use getters/setters or something else?

I took care of exercise 105. I don't know what to do with 115 though. I've worked a little bit more and progressed a slight bit, but here's the exercise: A team of biologists is conducting an experiment that involves collecting data on animals…
0
votes
2 answers

Using different classes to check on main form controls

I'm struggling to wrap my head around a concept and I've been at this for 4-5 hours now. So I'm hoping that someone can explain this to me. I have multiple checkboxes inside a tabpage labeled "tabpage2" on the main form "QoE" and I have multiple…
Nefariis
  • 3,451
  • 10
  • 34
  • 52
0
votes
2 answers

"Redundant" javadoc - desirable in public-facing APIs?

When you see something like this: /** * Gets the Person's identifier. * * @return The person identifier. */ public long getId() a lot of you may think "what's the point of repeating what the code implies"? I personally agree, and would not bother…
Sridhar Sarnobat
  • 25,183
  • 12
  • 93
  • 106
0
votes
1 answer

having trouble clearing textboxes

i want to clear all textboxes. wrote the public function as: public void clean(Control parent) { try { foreach (Control c in parent.Controls) { TextBox tb = c as TextBox; //if the control is a textbox …
New2This
  • 253
  • 1
  • 6
  • 22
0
votes
1 answer

Writing code to output file, and non-public type error

I have two problems that I am dealing with in my create a class of string instruments problem. First the requirements are: The name of the output file in the code of main must be the name specified on the command line, where you find the required…
Randy Gilman
  • 457
  • 1
  • 11
  • 21
0
votes
2 answers

android how to load a specific Activity to access public methods

i have a problem i don't want to load the current Activity like Activity currentActivity = getCurrentActivity(); i want to load another Activity... TabActivity MainTabView = (TabActivity) getParent(); TabHost tabhost =…
Jan Bludau
  • 321
  • 4
  • 11
0
votes
2 answers

Execute performExecute() using public static main(String args)

public class XGetProgramGuideDirectTestControllerCmdImpl extends ControllerCommandImpl implements XGetProgramGuideDirectTestControllerCmd { public final String CLASSNAME = this.getClass().getName(); public void performExecute() throws…
CodeTalk
  • 3,571
  • 16
  • 57
  • 92