isKindOfClass:returns YES if the receiver is an instance of the specified class or an instance of any class that inherits from the specified class.isM...
分类:
其他好文 时间:
2015-05-13 12:33:37
阅读次数:
86
用TCP通信模型创建一个web服务器 主要用ServerSocket 一直监听,这里将其放到while循环中,在循环体内单开一个线程 public class MyWebServer { public static void main(String[] args) throws IOExceptio...
分类:
编程语言 时间:
2015-05-13 12:23:06
阅读次数:
189
public class Solution { public boolean isPalindrome(int x) { if (x < 0) { return false; } return x == reverse(x); ...
分类:
其他好文 时间:
2015-05-13 12:19:59
阅读次数:
68
public class Person{ private String name;//,sex; private int age; public Person(String name, int age) { super(); this.name =...
分类:
其他好文 时间:
2015-05-13 12:16:11
阅读次数:
119
1 public class DBHelper 2 { 3 /// 4 /// 数据库帮助 5 /// 6 protected static DbHelper db = null; 7 8 9 ...
分类:
数据库 时间:
2015-05-13 12:04:24
阅读次数:
116
算法导论–第二章 merge sort java代码实现 1 public class Sort { 2 public static void main(String[] args){ 3 int[] arr = new int[]{8,30,19,1,45,...
分类:
其他好文 时间:
2015-05-13 12:01:06
阅读次数:
95
//派生类对象初始化基类的引用
//引用是别名,但这个别名只能包含派生类对象中的由基类继承来的隐藏对象
#include
using namespace std;
class B
{
public:
B()
{
cout<<"B"<<endl;
}
void fun()
{
cout<<"B::fun()"<<endl;
}
private:
int x;
};
cla...
分类:
编程语言 时间:
2015-05-13 10:40:21
阅读次数:
241
//
// 可以将一个派生类的对象的地址赋给其基类的指针变量,但只能通过这个指针访问派生类中由基类继承来的隐藏对象,
//不能访问派生类中的新成员。同样也不能反过来做。
#include
using namespace std;
class B
{
public:
B()
{
cout<<"B"<<endl;
}
void fun()
{
cout<<"B::fun()"<<...
分类:
编程语言 时间:
2015-05-13 10:40:20
阅读次数:
162
//探究类派生时构造函数的顺序
//在派生类对象的创建中,首先是虚基类的构造函数并按它们声明的顺序构造。
//第二批是非虚基类的构造函数按它们声明的顺序调用。
//第三批是成员对象的构造函数。最后是派生类自己的构造函数被调用
#include
using namespace std;
class B
{
public:
B()
{
cout<<"B"<<endl;
}
int x;...
分类:
编程语言 时间:
2015-05-13 10:40:14
阅读次数:
109
//继承派生中对象相互赋值情况
//派生类的对象可以赋值给基类的对象,这时是把派生类对象中从对应基类中继承来的隐藏对象赋值给基类对象。
//反过来不行,因为派生类的新成员无值可赋。
#include
using namespace std;
class B
{
public:
B()
{
cout<<"B"<<endl;
}
void fun()
{
cout<<"B::fu...
分类:
编程语言 时间:
2015-05-13 10:39:31
阅读次数:
141