Most voted "method" questions
A class method is nothing more than a collection of instructions grouped together for the purpose of executing a given task.
Learn more…271 questions
Sort by count of
-
1
votes1
answer672
viewsStatic method with object as parameter
I am creating a very simple system for enrolling students. I took a class Aluno as follows: public class Aluno { private String nome; private String matricula; private String curso; private int…
-
1
votes1
answer193
viewsWhat’s that part of the code called?
Let’s say I create a class... public class Teste1 { public void Teste1(){ System.out.println("Olá"); } public void teste2(){ System.out.println("Oi"); } } The Teste1 is the constructor method of the…
-
1
votes2
answers326
viewsVector receives method return
I am assembling a program in C# and created a method called Supply that receives an array called a number and returns the same. The idea is that the supply function creates random values, fill in…
-
1
votes2
answers5641
viewsWhat is the use of the word "self" in Python?
excuse my ignorance on the subject because I’m starting now in the Python language, and for this very reason I wanted to know what works the reserved word "self". Thanks for your attention and…
-
1
votes1
answer884
views"The best compatible overloaded method has some invalid arguments"
I’m creating a service with a method that has an argument like List<OrdemPais>(), and passing an object of this type to the method, but when compiling it appears the error: O melhor método…
-
1
votes1
answer182
viewsOverwrite static method
I don’t even know how to ask the question, but I’ll try. I have a static method in a parent class, and I planned to overwrite in the child classes, but from what I’m seeing here, this is not…
-
1
votes2
answers300
viewsReturn Javascript before finishing processing
I have this method: var getCardToken = function () { var passa = true; var code = false; var acardNumber= $("#ContentPlaceHolder1_txtNmCartao").val(); var acvv=…
-
1
votes1
answer112
viewsHow is the signature check of the super function
The function super() serves to call the parent builder and verify suitable signatures. public class Pessoa { private String nome; private String endereco; private String telefone; private String…
-
1
votes0
answers24
views -
1
votes1
answer227
viewsHow to call Finish() a separate class?
I have an application where when the user clicks "Back" on MainActivity he displays a AlertDialogin the method onBackPressed() asking if you really want to quit the app. But I created a new class…
-
1
votes1
answer46
viewsValue is not added to a variable within a function
I’m doing a simple quiz show with questions and answers, with punctuation. My problem is this: I made a function so that every time the answer is right, +1 will be added to the score variable.…
-
1
votes1
answer170
viewsHow to use a method that is within a class and sums two numbers in Ruby
class Soma def somar(num1, num2) @num1 = num1 @num2 = num2 result = num1 + num2 puts "O resultado é #{result}" end end summing = sum.new (1, 2) I can’t understand why the following code doesn’t…
-
1
votes3
answers209
viewsCan the "main()" method be overwritten or overwritten?
I read the answer What public Static void main(String[] args means)?, but I still have two doubts about the method main(): The method main() can be overloaded? The method main() may be…
-
1
votes1
answer147
viewsHow to call class method within the thread?
How do I call a class method inside a thread? I have a very simple thread and a class method. How do I call it inside the thread. As it is in the code below the compiler gives error #include…
-
1
votes2
answers223
viewsAre parameters with vectors in Java always by reference?
I am aware that, in Java, any parameter passage of an object is by reference, already with primitive types, by value. However, I was left with doubt about the common vector. I don’t mean the class…
-
1
votes2
answers347
viewsError in DELETE method, to delete a data from a table
I am trying to make a method to delete an entry from a table with Java and jsp, but is giving error 405. I will attach the codes. Productodao.java.: public void remove(Produto produto) {…
-
1
votes1
answer616
viewsHow to call a method within the class?
I’m trying to call the method that returns a unsigned char through another method of the same class, I reviewed the whole internet but did not understand how to do it. byte…
-
1
votes1
answer252
viewsDoubt about Python classes and methods
I have a question, I can’t do an exercise in classes and methods. 2 - Create the class "Date" with the attributes: day, month, and year. And create the methods "setarData(receives day, month and…
-
1
votes3
answers2177
viewsDifference between a return and no return method
What is the difference between a method with return and another without return? Since a method with no return could be just the sum of two numbers, I still have the result of this sum.
-
1
votes3
answers1181
viewsHow to access the elements of a list declared in a different class?
I have developed a code that generates a list when the following input data is informed: List size (or how many "Indexes") The values that will fill the said "Indexes". Values are collected within a…
-
1
votes2
answers235
viewsReset variable every time you switch to a method
I’m making a simple program that inserts at the first possible position of a vector, a String. This is the code I have: import java.util.Formatter; import java.util.Scanner; /** * * @author…
-
1
votes1
answer133
viewsDefine function result return or method
Editing: A previous function generates a list like this: ['Responsável atual', 'Número do processo', 'Foro de tramitação', 'Data da intimação 05/10/2017', 'Data da ação 15/08/2011'] This is the…
-
1
votes1
answer51
viewsSyntax error in final key
In my code are appearing the following errors: Error 1 } expected** Error 2 Type or namespace Definition, or end-of-file expected** using System; using System.Collections.Generic; using System.Linq;…
-
1
votes1
answer75
viewsUndefined method in Ruby
I’m trying to make a relationship between two tables in Ruby, where I use the student and grades but when I go to localhost:3000/Students/1/Notes it causes me the error my notes_controller.Rb: class…
-
1
votes1
answer139
viewsFunctions with different return in Go
I need to create an interface that contains a method decode(), but I need it to return different things to every struct that uses this method, and I don’t know how to do that. type teste interface {…
-
1
votes1
answer61
viewsFunction within a function
I’m doing some tests and I’d like to understand why when my role somadez() is called is returned to me that function soma() was not defined being that the same when it is called works. Follows the…
-
1
votes1
answer906
viewsPassing variable value obtained in one method to another method in Java
The project is a school GED, where there is the main class that makes the connection to database and there is another class to generate PDF files. The issue is that the system comes to extract the…
-
1
votes1
answer654
viewsStandard constructor to calculate an employee’s annual salary in C#
I need to make a code that calculates the annual salary (float) from the months worked (int) and monthly salary (float), but it has to be using the constructor method. Here’s a code I made but it’s…
-
1
votes0
answers75
viewsChanging the parameter of a java method
I am developing a code that uses ECC encryption. I am using the following code: import java.security.*; import java.security.spec.*; public class Teste { public static void main(String[] args) {…
-
1
votes2
answers102
viewsList something from a constructor
I have a code in Java that creates a client in the class Cliente: public class Cliente { String nomeCompleto; String dataNas; String email; String senha; } then I have the builder of this Cliente…
-
1
votes2
answers101
viewsWhat reason does the "missing()" at the end of the program send me an error in which it is not possible to compile?
Main Nota estudante = new Nota(); estudante.Matricula = Console.ReadLine(); estudante.Nome = Console.ReadLine(); estudante.Idade = int.Parse(Console.ReadLine()); estudante.Prova1 =…
-
1
votes1
answer70
viewsPassing parameters using primitives or an object containing the fields?
When creating the signature of a method, what would be the best design option for passing parameters? Is there any good practice that addresses the signing of methods? What would be better? For each…
-
1
votes2
answers58
viewsOrganization for future code maintenance when I have two similar functions
I have two functions, one returns only the first result and the other also returns the first result or returns more than one result. I created the "string all" parameter to define whether to return…
-
1
votes1
answer65
viewsSpeech recognition is giving stack overflow
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Speech.Synthesis; //namespace using System.IO; namespace SIF { public…
-
1
votes2
answers109
viewsAccess a Form method to another Form
I have a Method carregarLista() on form calling Funcionarios, and would like to access this method from another Form called Cancelar. The method is published in Form Funcionarios, I just can’t…
-
1
votes1
answer89
viewsMethod overload in C#
I am learning about overload methods in C# and would like to create a simple program that reads a user’s age and name, but would like to create two methods with the same name (overload) where…
-
1
votes0
answers37
viewsJavascript: method as object builder?
I would like to create a method within an object, but it assigns the properties to the object itself: Game = { personagens: [] }; Game.Personagem = function(obj = {}){ this.nome = obj.nome ||…
-
1
votes1
answer57
viewsInconsistent Accessibility: "Teacher" parameter type is less accessible than "Professor.Insert(Teacher)"
What do I do to fix this error? It turns red underneath the methods created in this code. And when I pass the mouse shows: Inconsistent Accessibility: "Teacher" parameter type is less accessible…
-
1
votes0
answers30
viewsProblems with Count method in a Django queryset
I’m in a strange situation with Django and Count method, I have a queryset that I called ranges and then I have a variable qtd_intervalo where I store the intervalos.count() then I do the tests: if…
python django web-application method viewmodelasked 4 years, 2 months ago Artur Fernandes de Souza Filho 21 -
1
votes1
answer86
viewsHow do I return a req.body.variable in a Express Rest api in a POST method?
When I try to return one req.body.qualquerVariavel acquired through a POST method, the return is undefined, and if I put the API to show on the console, it shows the value correctly, I wanted to…
-
1
votes1
answer27
viewsError using the 'is' method
I’m using the method is to check if, after a while, the mouse is inside or outside an element. However, for some reason, it is giving the following error: Uncaught Typeerror: Aucon.is is not a…
-
0
votes1
answer88
viewsFetch value from a non-static method of the class itself, in a jfieldtextFocusLost method
I have a method created by me that makes the return of a Boolean: public boolean ValidaNumero() { long valor; if(NIPCC.isFocusable()){ if (NIPCC.getText().length() != 0 ) { try { valor =…
-
0
votes1
answer638
viewsDefine method within the body of another method in Java
Hello, I was researching on Java and I came across the following code: cliente.getInetAddress().getHostAddress() I didn’t understand it very well. Is this a method within another method? I tried to…
-
0
votes2
answers303
viewsProperty of a method in another method
I have been researching about the problem, but I couldn’t solve it. I’m starting with object-oriented PHP and I’m having a question class Correios{ public $nome_do_user; public function…
-
0
votes0
answers62
viewsApplet asks for main method when executing, but does not have this method
I packaged the project in a jar that is an applet and I want this applet to run here in the old firefox browser linux, however, it asks to select a main method, but Applet has no main method. How to…
-
0
votes1
answer42
viewsSpecial character function: '=' in method name
Good afternoon, everyone. I know Ruby accepts three special characters in the method name: '!', '?' and '='. I need to know what "=" indicates and what it does.
-
0
votes1
answer104
viewsGet click (this) element in method
I’m refactoring a SPA using in practice the MVC with classes and etc... I made a method that is called when I click on an element <i> and would like to obtain this element to subsequently…
-
0
votes0
answers82
viewsCan’t find Controller’s method
I was testing some features on the project site that I am doing in MVC, but it has a function that is not working anymore. When accessing the site it says: "Method App Http Controllers…
-
0
votes1
answer101
viewsmethod chained in class with static methods
Good afternoon to all!!! How do I create a chained method, being it a static method? example: echo class::mymethod->$variable; Thank you
-
0
votes1
answer229
viewsSequential execution in Javascript or Angularjs
I am creating a controller for an Angularjs application, in this controller I will have 3 methods that must be executed in sequence. EXAMPLE: $scope.albums = []; $scope.photos = []; //Metodo que vai…