Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| ||||
Interview Questions and Answers for 'Date' - 14 question(s) found - Order By Newest | ||||
| ||||
Ans. OOPs or Object Oriented Programming is a Programming model which is organized around Objects instead of processes. Instead of a process calling series of processes, this model stresses on communication between objects. Objects that all self sustained, provide security by encapsulating it's members and providing abstracted interfaces over the functions it performs. OOP's facilitate the following features 1. Inheritance for Code Reuse 2. Abstraction for modularity, maintenance and agility 3. Encapsulation for security and protection 4. Polymorphism for flexibility and interfacing | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  oops  oops features Asked in 260 Companies basic   frequent | ||||
| ||||
Ans. In first case, there would be 2 DB calls in worst case and 1 in best case. In 2nd approach there will be always 2 DB calls. Decision on the approach should depend on the following considerations - 1. How costly is the call to DB ? Are we using indices , hibernate etc If calls to DB are costly , 1st approach should be the choice. 2. Exception Book keeping load upon exception. The benefit of saving 1st call in approach 1 should be bigger than the Book keeping for the exception. 3. Probability of the exception in first apparoach. If the DB Table is almost empty, it makes sense to follow Approach 1 as majority of the 1st calls will pass through without exception. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  database   insert-update   db exceution plan   db strategy   design   architecture   technical lead | ||||
| ||||
Ans. No. It gives the error "Cannot Instantiate the type Calendar". Calendar is an abstract class and hence Calendar object should be instantiated using Calendar.getInstance(). | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   date   calendar   abstract class   yes-no | ||||
| ||||
Ans. Date is not a abstract class whereas Calendar is. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   date   calendar   abstract class | ||||
| ||||
Ans. Date and Time after 5 months from now. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   date   calendar   scjp   ocjp   coding   code | ||||
| ||||
Ans. All except c are correct. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   date   dateformat | ||||
| ||||
Ans. It is used to parse String to get the Date Object with initialized date. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   date   dateformat | ||||
| ||||
Ans. c | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   java.util   date   dateformat | ||||
| ||||
Ans. It will throw the ParseException as the date format doesn't abide with the format of the specified date. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  date   utility classes   dateformat   exception   parseexception | ||||
| ||||
Ans. http://www.buggybread.com/2015/02/java-util-date-time-classes-and.html | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   util   java.util.date   time | ||||
| ||||
Ans. [Iterable] | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   BatchUpdateException   include | ||||
| ||||
Ans. hh= hours in 1-12 format HH= hours in 0-23 format kk = Hours in 1-24 format KK= hours in 0-11 format | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  Date  Date Time Format  Date Time | ||||
| ||||
Ans. public class Class{ public static void main(String[] args){ String str = "xyz@123.com"; if(!str.contains("@") && !str.contains(".") && (str.indexOf('.') < str.indexOf('@'))){ System.out.println("Not a Valid Email Address"); } } } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  validate an email address  coding  code Asked in 3 Companies | ||||
| ||||
Ans. LocalDate today = LocalDate.now(); LocalDate birthday = LocalDate.of(1960, Month.JANUARY, 1); Period p = Period.between(birthday, today); //Now access the values as below System.out.println(period.getDays()); System.out.println(period.getMonths()); System.out.println(period.getYears()); | ||||
Sample Code for LocalDate Sample Code for Period | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  coding  code  date  LocalDate  Period Asked in 1 Companies | ||||