- 浏览: 1051288 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (1355)
- test (75)
- 红茶和绿茶 (1)
- Jave SE (206)
- Oracle (19)
- English (177)
- Log4j (5)
- RIA(Rich Internet Applications) (9)
- Ext Js (6)
- Android (14)
- Logo (0)
- 文字采撷 (287)
- 使用技巧 (92)
- Project Management (22)
- Hibernate (12)
- Struts (5)
- 规则引擎 (1)
- Html & Javasctipt (56)
- Spring MVC (10)
- Maven (17)
- Java Test (17)
- Linux (16)
- Tools (1)
- CV (0)
- Middleware (2)
- HTML5 (2)
- Algorithms (4)
- Web Service (15)
- 留学 (15)
- LADP (5)
- PXCOA (0)
- SysLog (6)
- SSO (3)
- Spring Security (4)
- Spring Batch (1)
- Jmail (1)
- Bible (4)
- Java Thread (5)
- Architect (6)
- github (2)
- Java Swing (12)
- NoSQL (7)
- UML (2)
- 敏捷(Agile) (7)
- Hudson+Maven+SVN (15)
- cloud computing (2)
- Bahasa Indonesia (1)
- jBPM (6)
- 民俗知识 (3)
- Consulting (1)
- Mysql (5)
- SAP (1)
- 微信公众平台接口开发 (3)
- 做生意 (1)
- 西餐 (1)
- Banking (1)
- Flex (0)
- 黄金投资 (1)
- Apache Tomcat 集群 (3)
- Hadoop (7)
- 需求分析 (1)
- 银行知识 (3)
- 产品管理 (2)
- 钢琴Music (3)
- 设计 (3)
- Marketing (2)
- US Life (3)
- 算法 (14)
- BigData (4)
- test红茶和绿茶Jave SEOracleEnglishLog4jRIA(Rich Internet Applications)Ext JsAndroidLogo文字采撷 (0)
- Design Pattern (5)
- NodeJS&AngularJS (9)
- Python (1)
- Spring boot (0)
- ACM (3)
最新评论
-
心往圣城:
微时代-最专业的微信第三方平台。LBS定位导航,微网站,自定义 ...
微信公众平台 /微信公众平台怎么用 -
zhaojiafan:
return ReverseStr1(str.substrin ...
逆转字符串 Write a String Reverser (and use Recursion!) -
zhaojiafan:
public class StringUtils {
p ...
逆转字符串 Write a String Reverser (and use Recursion!)
OOPS Concept
Q1) What is polymorphism?
Ans) Polymorphism gives us the ultimate flexibility in extensibility. The abiltiy to define more than one function with the same name is called Polymorphism. In java,c++ there are two type of polymorphism: compile time polymorphism (overloading) and runtime polymorphism (overriding).
When you override methods, JVM determines the proper methods to call at the program’s run time, not at the compile time. Overriding occurs when a class method has the same name and signature as a method in parent class.
Overloading occurs when several methods have same names with
?Overloading is determined at the compile time.
?Different method signature and different number or type of parameters.
?Same method signature but different number of parameters.
?Same method signature and same number of parameters but of different type
Example of Overloading
int add(int a,int b)
float add(float a,int b)
float add(int a ,float b)
void add(float a)
int add(int a)
void add(int a) //error conflict with the method int add(int a)
Example: Overloading
Class BookDetails{
String title;
String publisher;
float price;
setBook(String title){
}
setBook(String title, String publisher){
}
setBook(String title, String publisher,float price){
}
}
Example: Overriding
class BookDetails{
String title;
setBook(String title){ }
}
class ScienceBook extends BookDetails{
setBook(String title){} //overriding
setBook(String title, String publisher,float price){ } //overloading
}
Q2) What is inheritance?
Ans) Inheritance is the property which allows a Child class to inherit some properties from its parent class. In Java this is achieved by using extends keyword. Only properties with access modifier public and protected can be accessed in child class.
public class Parent{
public String parentName;
public int parentage;
public String familyName;
}
public class Child extends Parent{
public String childName;
public int childAge;
public void printMyName(){
System.out.println(“ My name is “+ chidName+” “ +familyName)
}
}
In above example the child has inherit its family name from the parent class just by inheriting the class.
Q3) What is multiple inheritance and does java support?
Ans) If a child class inherits the property from multiple classes is known as multiple inheritance.
Java does not allow to extend multiple classes but to overcome this problem it allows to implement multiple Interfaces.
Q4) What is abstraction?
Ans) Abstraction is way of converting real world objects in terms of class. For example creating a class Vehicle and injecting properties into it. E.g
public class Vehicle {
public String colour;
public String model;
}
Q5) What is encapsulation?
Ans) The encapsulation is achieved by combining the methods and attribute into a class. The class acts like a container encapsulating the properties. The users are exposed mainly public methods.The idea behind is to hide how thinigs work and just exposing the requests a user can do.
Q6) What is Association?
Ans) Association is a relationship between two classes. In this relationship the object of one instance perform an action on behalf of the other class. The typical behaviour can be invoking the method of other class and using the member of the other class.
public class MyMainClass{
public void init(){
new OtherClass.init();
}
}
Q7) What is Aggregation?
Ans) Aggregation has a relationship between two classes. In this relationship the object of one class is a member of the other class. Aggregation always insists for a direction.
public class MyMainClass{
OtherClass otherClassObj = new OtherClass();
}
Q8) What is Composition?
Ans) Composition is a special type of aggregation relationship with a difference that its the compulsion for the OtherClass object (in previous example) to exist for the existence of MyMainClass.
发表评论
-
各种在线工具
2018-05-10 05:52 412http://rextester.com/ -
Java Array sort and Collections sort
2018-04-11 04:55 385package com.test; imp ... -
webpack+es6+node+react初实践及总结
2018-02-01 10:38 362webpack+es6+node+react初实践及总结 ... -
Interview Preparation
2018-01-25 08:26 438Algorithms https://www. ... -
深入理解Java集合框架
2017-08-18 08:40 622https://github.com/CarpenterLe ... -
logic gate (AND, OR, XOR, NOT, NAND, NOR and XNOR)
2017-08-18 08:33 2454A logic gate is an elementary ... -
深入理解Java PriorityQueue
2017-08-18 01:25 420本文github地址 Java中PriorityQueu ... -
jwt-spring-security-demo
2017-08-12 07:30 609https://github.com/szerh ... -
Java Program to Check Whether a Number is Palindrome or Not
2017-08-08 06:59 548public class Palindrome { ... -
Java实现Tire
2017-08-07 08:14 597Java实现Tire Trie ... -
OpenID, SAML, and OAuth
2017-08-03 07:03 594Single sign-on (SSO) started i ... -
分享两个JavaEE 非常好的网站,案例丰富
2017-08-01 09:07 349http://www.mkyong.com/al ... -
Introduction to Programming in Java
2017-07-19 13:26 459http://introcs.cs.princeton.ed ... -
Two piece of code
2017-06-20 00:43 430if ( updateRe ... -
ACM Online Judge
2017-06-05 01:26 455http://acm.nyist. ... -
java枚举使用详解
2017-05-25 06:16 465package com.ljq.test; /** ... -
Longest Common Substring
2017-05-21 08:22 505Dynamic Programming | Set 29 ( ... -
Dynamic Programming
2017-05-06 10:48 366Dynamic Programming | Set 1 (O ... -
Predefined Character Classes
2017-04-24 02:45 402Predefined Character Clas ... -
IS-A Relationship And HAS-A Relationship
2017-04-13 14:50 1703One of the advantages of an Ob ...
相关推荐
Data Structures & Algorithms Interview Questions You'll Most Likely Be Asked 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
根据提供的文件信息,这份《Java Interview Notes_ 700 Java Interview Questions Answered.pdf》的文档内容非常丰富,涵盖了Java编程语言面试时可能遇到的多个核心知识点。下面是根据标题和描述生成的知识点详细...
Microsoft Interview Questions Microsoft Interview Questions
Coding Interview Questions(3rd) 英文azw3 第3版 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
### Java Interview Questions 更新于2018年9月 #### 1. 什么是JVM? JVM(Java虚拟机)是运行Java应用程序所必需的解释器及其运行时环境的组合。它提供了一个运行Java字节码的标准平台,使得Java程序可以在任何...
"interview questions"这个主题通常涵盖了一系列与编程、系统设计、算法、数据库、操作系统、网络以及其他相关领域的常见问题。这篇博文链接指向了ITEYE上的一个博客,虽然具体内容无法直接获取,但从“源码”和...
在给出的文件“Dynamic Programming Interview Questions Solved in C++”中,作者Antonio Gulli通过一系列典型问题,深入解析了动态规划在C++中的应用,下面将详细介绍这些知识点。 1. 斐波那契数列(Fibonacci ...
Haldane's Best Answers to Tough Interview Questions 面试常见问题应对
devops interview questions by tech interviews get it for devops interview
### CCIE Interview Questions与模考规则解析 #### CCIE认证简介 CCIE(Cisco Certified Internetwork Expert)认证是由思科公司设立的一项高级网络工程师认证,是业界公认的技术含量最高、最权威的网络技术认证之...
系统设计面试题集是一本专注于计算机科学与工程领域中系统设计相关问题的参考书,它是由Antonio Gulli所著,并于2016年出版。这本书是作者关于算法、问题解决以及C++编程25章系列著作中的第九章,致力于介绍系统设计...
### C/C++ 面试问题解析 #### 容器类(Container Class) **定义:** 容器类是一种用于在内存或外部存储中保存对象的类。这类类充当了一个通用的持有者,它拥有预定义的行为和一个众所周知的接口。...
AWS Interview Questions
根据提供的文件信息,我们可以从中提炼出三个重要的面试问题及其回答策略。这不仅是对求职者面试技巧的考验,也是展示个人专业素养与职业态度的关键时刻。接下来,我们将详细解析这三个问题及如何给出恰当的回答。...
### IT面试问题与答案解析 #### 1. 如何描述自己? **优秀示例回答:** 我的背景至今一直围绕着成为一名最优秀的财务顾问而努力。让我具体介绍一下我是如何准备自己的。我是一名在______大学主修金融和会计的本科...
### IT面试常见问题详解 #### 一、自我介绍:讲述一下你自己 在软件工程师的面试过程中,这是一个非常常见的开场问题。对于这个问题的回答应当简洁而有力,重点突出与应聘职位相关的工作经历和个人技能。...
(Summary of Vue Interview Questions) # vue 面试题汇总 1、active-class 是哪个组件的属性?嵌套路由怎么定义 (1)、active-class 是 vue-router 模块的 router-link 组件的属性 (2)、使用 children 定义嵌套路由 ...