Hy there i a beginner in java started 3 weeks ago, im having some problems with this code.
in the main method i have an array containing 10 elements.
i've already made several methods to like
public static void println(int[] array) ------ to print and array
public static boolean isPrime(int el) ----------- prime test. returns tru...
Is it possible to make a method that returns a string [ ] in java????
...
Ok really stupid question, but I have some methods defined in a file called x.java, which is in the default folder, and in the same folder, I have a file called z.java. I want to use the functions defined in x in z. When I try, it tells me the function is undefined. I tried to put import x.java; but it says x.java cannot be resolved. Wha...
I'v created this class here:
//Integer rectangle class
class AguiRectangle {
int x;
int y;
int width;
int height;
public:
bool isEmpty {
return x == 0 && y == 0 &&
width == 0 && height == 0;
}
int getTop() {
return x;
}
int getLeft() {
return y;
}
int ge...
I like using question mark at the end of method/function names in other languages. Java doesn't let me do this. As a work around, how else can I name boolean returning methods in java ? Using an 'is', 'has', 'should','can' in the front of method sound ok for some cases. Is there a better way to name such methods ?
For e.g. createFreshSn...
I would like to override a method in an object that's handed to me by a factory that I have little control over. My specific problem is that I want to override the getInputStream and getOutputStream of a Socket object to perform wire logging; however the generic problem is as follows:
public class Foo {
public Bar doBar() {
...
If I have a method like this:
- (void) foo
{
}
Then I can access it through a selector like this:
@selector(foo)
But what if I have a method like this:
- (void) bar:(NSString *)str arg2:(NSString *)str2
{
}
Then how do I access it through a selector?
...
Hi guys!
I need help with functions in objective C?
In C++ i can make a function like this:
int testFunction(int zahl) {
int loop;
loop = zahl * 10;
return loop;
}
this function multiply my zahl with 10 and returns the result. In C++, i can call this function whenever i want with:
testFunction(5);
and it returns 50. ...
Using urllib2, are we able to use a method other than 'GET' or 'POST' (when data is provided)?
I dug into the library and it seems that the decision to use GET or POST is 'conveniently' tied to whether or not data is provided in the request.
For example, I want to interact with a CouchDB database which requires methods such as 'DEL',...
I'm having some difficulty with writing some jQuery code. What i'm trying to do is pass multiple methods through an event handler like so $(foo).click(methodOne , methodTwo); The purpose of the first method is to fade out the current view and then hide it and the purpose of the second method is to display an alternate view. For whatever ...
Is the following code safe? (I already know it compiles properly.)
void Tile::clear()
{
*this = Tile();
}
int main()
{
Tile mytile;
mytile.clear();
}
...
when extending a class, is it impossible to override a method without also matching the parameters?
for example, i'd like to use the method's name, in this case it's a socket extension and the method i want to override is connect. however, i want to request additional parameters that the stock connect function does not request.
is the...
This is my GET Method to get my data from my DataTable
Private Function GetData() As PagedDataSource
' Declarations
Dim dt As New DataTable
Dim dr As DataRow
Dim pg As New PagedDataSource
' Add some columns
dt.Columns.Add("Column1")
dt.Columns.Add("Column2")
' Add some test data
For i As Integer = 0 To 10
dr = dt.NewRo...
Hi everyone,
Is there a way to have extension method on the method? Example for this would be method that takes some user object as parameter and you need to do security check if that user can use that method at the very beginning of the method. Can the method have extension method like "check can this user use me" and return bool.
Th...
Hi All,
I want to get class methods in an object. Please see the following example
I have a class "user.rb"
class User
def say_name
end
def walk(p1)
end
def run(p1, p2)
end
end
and I wrote the following code
require 'user.rb'
a = User.new
arr = a.public_methods(all = false)
Above code will return the method ...
In C# 1. You don't have delegate sorting or comparison options. You might be forced to do it by creating another type which implements IComparer to sort your collections in ArrayList.
But starting from c# 2. You can use delegates for your comparisons. Look the following example.
List<Product> products = Product.GetSampleProducts();
prod...
Hi
I Have a Java application and I need to convert it to an Android application
is there any resources to show how ? in Android developer site I didnt found anything like that!
I need to use the Java methods and classes in android ,How it can be done?
...
Hey everyone,
I am developing a mobile application (BlackBerry) with Java that makes use of the Google Translate API. I have it set up so that a user can specify a language before logging in, and then once they log in, I have wrappers around every piece of text displayed to screen which will translate the text based on the language cho...
How would this code be different if the method was in a different class?
[saveButton addTarget:self action:@selector(saveArray) forControlEvents:UIControlEventTouchUpInside];
...
I have an IBAction button that I would like to enable after a 30 second delay. the button would be in the view but disabled for 30 secs.
does anyone know how I would go about doing this?
here's what I have - a simple IBAction that plays some audio:
-(IBAction) playSound:(id)sender {
[theAudio play];
}
thanks for any help.
...