Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Easy Queries

 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how is Interface is a java.lang.object

what's difference between format and printf in java.io.Console ?
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mohitkumar gupta wrote:how is Interface is a java.lang.object

It's in polymorphic way! What do you assign for Interface references?
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mohitkumar gupta wrote:what's difference between format and printf in java.io.Console ?

Other than the name, nothing whatsoever. format is the "natural" name, printf is there for familiarity for C/C++/etc users, as it's very similar to the function of that name in those languages.

As the API docs say:
Java API wrote:A convenience method to write a formatted string to this console's output stream using the specified format string and arguments.

An invocation of this method of the form con.printf(format, args) behaves in exactly the same way as the invocation of con.format(format, args)
 
Prasad Kharkar
Ranch Hand
Posts: 446
1
Eclipse IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
every class in java extends Object class
and any class can implement any interface
hence that interface IS-A Object

but that interface is NOT in the inheritance tree
 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

One more Query



THE Line gives error

WHY ?


can't byte be cast to Character ?

but it's allowed to cast byte,int to char
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mohitkumar gupta, There are in the same level in the hierarchy! You can't cast one type to another which are in the same level.!
 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic