• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Queries--2

 
Shaily Sharma
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) When does an overloaded constructor gets invoked, without explicit call to it from default constructor.

2)List list = new ArrayList();
Iterator<String> it = list.iterator()
From where does iterator() method comes? ArrayList() doesn�t implement this method, list has it but how its possible to invoke it, as interface doesn�t provide its implementation, how can we invoke this method?

3) Mock exam drag n drop question:
String str = �April 15, 2005�;
Date date = DateFormat.__________(_________, Locale.US).____________(str)
Code Fragments: DateFormat.FULL , getDateInstance, parse, getDate, format ,getDateFormat, DateFormat.LONG, DateFormat.SHORT

if i put parse option in last slot it gives parseException. wats the correct way?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) When it's called from somewhere other than the default constructor.

2) That's the beauty of polymorphism.

3) Which date format are you using (FULL, LONG, or SHORT)? One of these will work.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15441
41
Android IntelliJ IDE Java Scala Spring
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, its always better to use Use a meaningful subject line .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic