Why does Bruce Eckel says that only objects can be passed into a method in Java? -


here's quote bruce eckel's book "thinking in java":

the method argument list specifies information pass method. might guess, information—like else in java—takes form of objects. so, must specify in argument list types of objects pass in , name use each one.

i don't it. think can pass primitives method (e.g. int) , primitives aren't objects. example:

public static int multiply(int x, int y){     return x * y; 

this method , there primitives in it, no objects @ all.

the author doesn't only objects can passed methods. quote comes in context of chapter called "everything object". aims highlight object-oriented aspect of language, includes section on primitives explains special case.

nevertheless, method taking primitive types still correct implicitly covered "special case: primitive types" section.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -