Top "Methods" questions

A method is a block of code that performs a task and is associated with a class or an object.

Is it possible to overload Python assignment?

Is there a magic method that can overload the assignment operator, like __assign__(self, new_value)? I'd like to forbid …

python class methods assignment-operator magic-methods
"System services not available to Activities before onCreate()" Error message?

When the user hits an icon in my app, I want the app first to check if the device is …

android methods oncreate
Read the value of an attribute of a method

I need to be able to read the value of my attribute from within my Method, how can I do …

c# .net reflection attributes methods
Should I call SqlDataReader.HasRows if I am calling SqlReader.Read

Trying to see if it is beneficial to add an if (dr.HasRows) before the while (dr.read()) function. I …

c# sql .net methods sqldatareader
Calling a method in a Javascript Constructor and Accessing Its Variables

I am trying to call a method from the constructor of my javascript constructor, is this possible and if so, …

javascript prototype constructor methods
Java: Adding fields and methods to existing Class?

Is there, in Java, a way to add some fields and methods to an existing class? What I want is …

java methods field add
What is the purpose of "!" and "?" at the end of method names?

Sometimes I see methods in Ruby that have "?" and "!" at the end of them, e.g: name = "sample_string" name.…

ruby methods syntax predicate syntactic-sugar
Python-like list comprehension in Java

Since Java doesn't allow passing methods as parameters, what trick do you use to implement Python like list comprehension in …

java python parameters methods list-comprehension
How to detect unused methods and #import in Objective-C

After working a long time on an iPhone app, I realized that my code is quite dirty, containing several #import …

objective-c xcode methods compiler-warnings
SetFocusable method or Focusing Components Java

I came across this code: public class Board extends JPanel implements ActionListener{ public Board() { setFocusable(true); } } What exactly does setFocusable(…

java swing methods jpanel focusable