A method (often called function, routine or procedure) is code that performs a task and is associated with a class or an object.

0
votes
1answer
14 views

Java single method for all debug lines in a class in log4j

I would like to write common method for all my Logger.debug("") occurances.public void debug(String message){if(Logger.isDebugEnabled()){LOGGER.debug(message);}}and in the same class I ...
3
votes
1answer
30 views

How do I use the public variables and methods in this class?

The following code creates 12 panels with a label and a button on each panel.public MainFormWithPanel() {InventoryFileReader reader=new InventoryFileReader();ArrayList<Car> cars=...
0
votes
4answers
43 views

Is there any point in using local functions if to only use them once?

Imagine I have this code:public void Foo(){// Do bar work// Do baz work// Do foobar work}And I realize I can (and should because it was doing more than one thing) refactor it into:...
1
vote
3answers
30 views

How to return 2 decimal places (String) from a method in a different class in java

import java.util.ArrayList;import java.util.Scanner;class Loan{double loan;public String toString(){return "Loan: " + loan;}}class Main{public static void main(...
1
vote
0answers
19 views

check if method is static from metaclass [duplicate]

I have a use case where I use a metaclass to decorate instance methods of a class.class DecoratedMeta(type):def __new__(mcs, name, bases, attrs):cls=super(DecoratedMeta, mcs)....
0
votes
2answers
38 views

Validate a course code using a method in java

I have to get my course code to validate. The course code is set to a number 1-7 and the choice has to be within this range. Each course is worth 3 credits. The user can not register for more than ...
-4
votes
2answers
49 views

The method getTime() is undefined for the type Object — what’s wrong?

I have created an application that generates a difference between two dates when u click on a button named "calculate difference", but I don't know whats wrong with this code. I tried different ...
0
votes
5answers
41 views

Return types and Methods in java

Can you guys help me fix the following program?It is giving me the following error: error: method absoluteValue in class Pset3Ex4 cannot be applied to given types;import java.util.Scanner;...
0
votes
1answer
22 views

Adding one or more instance of a class in another class

I have Movie and Actor classes. I need to add an addCast(cast) method that allows the addition of one or more Actors to a movie.I already have:class Movie{constructor(name, year, duration){...
1
vote
0answers
23 views

Python: how to speed up this method of exhaustion? Trie?

I have a corpus with lines of sentences without spaces between words:thenextdayonmayanarchistsstagedarallyatchicagoshaymarketsquare...
-4
votes
0answers
23 views

Is there a universal method that compares 2 objects of any type? [Java]

My idea for example is to try all possible ways of object comparison:“==”, “equals()”, “compareTo()” and “compare()and use a universal exception handling several times
0
votes
0answers
25 views

How to exclude classes from polymorphism [JAVA]

I need that Inteface is implemented by different classes for its methods but also in order to use polymorphism on that supertype.All the classes have the same characteristics and they must be ...
0
votes
2answers
34 views

Retrieving Only a Return value from a method that contains System.out.print

How do I retrieve only the return value from a method if there is also a System.out.print in that method. In the following code I will get the return value but every time I call the method it also ...
0
votes
0answers
13 views

Python use a method parameter to determine which variable is updated [duplicate]

I have a class named char. Inside char I have multiple variables accessed with char.int, char.str, etc. I wanted to create a method that would change a variable based on the parameter like thisdef ...
-4
votes
2answers
48 views

count method in Java

How is this method is a count method? can someone please help me understand it, especially, what is the role of int a? Thanks private static int _______ (int[] values, int a) {int k=0;...
0
votes
2answers
32 views

Cannot use a method imported from another class using Stream and Lambda

Something strange: I cannot use a method implemented in an imported Class.I have the class called "Person.java" which contains an implemented method called "isFrom()", as you can see below:import ...
0
votes
6answers
26 views

Make new json object by reduce key

I have searched stack overflow for about 30 minutes but I am not sure that I can use filter, map or reduce. I have the following JSONInput[{"_id": "5a3711070776d02ed87d2100","index": ...
1
vote
0answers
15 views

How can I store a plugin method call in the settings of another plugin call without executing it in jQuery?

I have two jquery plugins. Lets call them plugin A and plugin B. I want to assign a method from plugin B to one of the settings of plugin A. My problem is that the method from pluginA.settings.action ...
-4
votes
2answers
59 views

java:variable has not been initialized [on hold]

The aim of the program is to find factorial of a number specified during runtime.What I did is Entered All the required arithmetic operations and Statements in the function and in main function all ...
0
votes
0answers
25 views

I don't get it why isn't piece of code related to “Constructors” in php code not working? [on hold]

Hi there i'm very new and right now im learning from a book teaches php5 and right now I don't entirely get it about Constructors in Chapter about PHP Functions and Objects. Below is an "...
0
votes
1answer
57 views

how to test this method using mockito or Junit?

@Overridepublic void storeInfoInStaging(StagingInfo stagingInfo) throws BusinessException {INotificaDao iNotificaDao=NotificaDaoFactory.getInstance().getNotificaDao();try ...
0
votes
3answers
29 views

Why is my code displaying unmoving circles?

So here's my code, pretty simple stuff:void setup(){size(200,200);background(255);}void draw(){ac();}void ac(){ int xPos=10;int yPos=20;int sizeXY=40;int xInt=10;int ...
-4
votes
0answers
31 views

Cannot find symbol error when using method from other class [duplicate]

I have two different files for a tic tac toe game I'm making for my computer math final project.import javax.swing.JFrame;import java.awt.Container;import java.awt.Font;import java.awt.GridLayout;...
1
vote
3answers
29 views

How to make global class var in the class method

I want to make a global instance of class 'test' if condition is satisfied.I just wrote code intuitively, which is not working. How can I fix it?class test:def __init__(self, a=0, b=0):...
4
votes
1answer
38 views

How is the element passed into the callback method in JavaScript?

I'm currently learning JavaScript and I am slightly confused as to how the callback function for the Array.find() method works, I have this current code:const numbers=[43,46,33,23,44,36,5]...
2
votes
2answers
43 views

Can't write statements inside methods. Functioning of java classes. “error: ”;“ expected”

I've spent hours trying to solve this problem, with other posts' and google help, but to no avail. Basically I can't write statements in methods of the PESO class public class TEST {public ...
1
vote
2answers
28 views

Override only parts of a method

I want to override the method setText in my JDoubleField that extends JTextField to filter the parameters to guarantee that the input is parse-able. The filter itself is a short piece of code, but I ...
0
votes
0answers
26 views

Java - converting console UI to GUI including methods

Good evening all,At the moment I wanna swap my console UI to a GUI. I've certain methods in my UI main class which should be in the GUI one too. How can I implement the inloggenGebruiker method in ...
0
votes
2answers
63 views

What is the possible use of (Monad) Option.size in scala

When we do Some(“some values”).size it returns 1. When we do None.size it returns 0. I was wondering what could be the possible use of the size method on an option. val x=Some(1,2,3,4).size...
0
votes
2answers
23 views

Browser does not replace an include file by its including file

I am an absolute beginner in JS.1) What I'm trying to do:My web pages are composed of an index.php which is the same for all the files of a directory and one of a set of content.inc, like this: ...

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,