Eduardo Hernandez

Greenhorn
+ Follow
since Jul 09, 2011
Eduardo likes ...
Java Linux
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Eduardo Hernandez

You need to understand this:

Method body or method implementation is what is inside curly braces after the method declaration (including the braces).
Return type could be a primitive or an object reference.

Interfaces declaration consist of abstract methods declarations plus constant(s) if any. What does it means to declare a method to be abstract? The method must provide a signature (name and 0 or more parameters type), return type and throws if any (optional) and no method body (not implemented) (can't end with curly braces but a semicolon after the "closing parenthesis"): myMethod() or myMethod(int x) are valid method signature examples but then you MUST add the return type: int myMethod(); or void myMethod(int x);


One last thing to remember interface methods are implicitly public and abstract.

What you're seeing is a method named comparator that happens to return a Comparator.
9 years ago
70 developer positions is a lot for a location if you reconsider and decide to sponsorship you guys will fill all those positions.
9 years ago
Ok let me try to explain the concepts behind all of this to you.

Fist example explanation:

When you do this:
int i[] = {0};

You're actually declaring an integer array reference variable (i), constructing an one-element one-dimension array object of integers in memory (the heap) and assigning 0 or initializing the array element with 0.

it's like: int[] i = new int[1]; i[0] = 0;

The array reference variable "i" isn't actually the array object, it is just a reference holding the address of where in memory the created array object is. Reference variables are just variables that can point to objects of a specific type in memory.

When you pass a object reference variable to a method (change_i(i); in the first example) you are passing the object reference (the address of how to get to the object) not the real object and then you assign that address to another reference variable of the same type inside the method. It's like pointing the variable inside the method to the same object the variable outside the method is referring to so you can access the same object with both variables.

That's why when you assign another value or modify the value of the array element by means of the "inside the method reference variable" you can access that element with the reference variable outside the method because both are pointing to the same object in memory (the heap).


Second example explanation:

When you pass primitive variables you are passing a copy of the value of that primitive variable to the method. The variable declared inside the method definition is just a different variable that happens to have the same name as the variable declared outside the change_i method and that gets a copy of the value of the variable passed to it. Whatever modification you do inside the method is to the value of the inside variable.

So the System.out.println(i) is actually printing the variable outside the method which is holding 1.

Try to print i inside the method and you will print out the modification. you an even modify the method to return a int and return the modification and assign it back to the i variable declared outside.

Hope you can get the concepts.
9 years ago
Get a copy of Kathy Sierra & Bert Bates Head First Java 2nd Edition and you'll see that Java isn't that complicated.
9 years ago
The entry point of a Java program is the main method, the signature of main must look like this: public static void main(String[] args) { }. When you execute (run) a java program the JVM looks for the main method in your class (program) to start executing your program's instructions if it can't find the main method definition the JVM complains and displays that error.
9 years ago
wow.. I'm just here laughing of myself... how I didn't figure it out haha! Thanks!
9 years ago

I have written a custom exception and invoking the getMessage() method inherited from java.lang.Throwable doesn't return the detail message string.

The following is my custom exception code:



The MyException(String) constructor calls super(message) to construct a throwable with the specified detail message. If I do call printStackTrace() method on a MyException reference it does print the stacktrace along with the detail message:

MyException: My Message
at exTest.check(exTest.java:13)
at exTest.main(exTest.java:5)

The getMessage() method doesn't return the detail message. The following is the test class:



9 years ago

Bear Bibeault wrote:I'd say that's sufficient reasons.



I agree that those are sufficient reasons but the point is to get the whole pack and complete the list from the guys that "knows" both languages.

Perhaps the Authors should add the rest if we are still missing....
9 years ago
iOS

Pat Farrell wrote:The point is that writing for IOS essentially requires you to write in Objective-C. These days, the best way for an independent to have a profitable product is to sell it through the app-store, which means writing Objective-C.



Good one... PROFIT!

Pat Farrell wrote:The good reason is that when you write in Objective-C, you get, for free, or at least no cost to use, a very rich framework that gives your app the native look and feel, and all the cool multi-touch support, etc. Java is cursed/blessed with being platform independent, so you only get to use the minimal common subset of features on all platforms. THis means that Java is way behind IOS on cool touch and sensor apps.



Another one.. "Native look and feel" and "Multi-Touch Support".

What else guys?
9 years ago
iOS

Bear Bibeault wrote:I said nothing about performance.



I know you didn't say something explicitly about performance but since performance is one of the benefits of coding in native....

It's all about what language is best supported in the environment.[/quote wrote:

Please point/post what about Java isn't supported and what is best supported in Objective-C than Java.

9 years ago
iOS

Bear Bibeault wrote:If you want to write native apps for either OS X or iOS, Objective-C is the language of least resistance.



So.. it's just all about performance?
9 years ago
iOS

I mean... If somebody already has mastered Java why should bother learning Objective-C?

9 years ago
iOS