自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(69)
  • 收藏
  • 关注

原创 字符缓冲流特有功能复制java文件

public static void main(String[] args) throws IOException { //根据数据源创建字符缓冲输入流对象 BufferedReader br=new BufferedReader(new FileReader("e:\\java\\11\\123.java")); BufferedWriter bw=new BufferedWriter(new FileWriter("e:\\java\\11\\456.java")); .

2022-05-13 22:35:14 114

原创 java 遍历目录 字符缓冲流字符数组读取 复制视频 耗时最短

JAVA 遍历目录public static void main(String[] args) throws IOException { /*File f=new File("e:\\java\\name.txt"); f.createNewFile(); File f2=new File("e:\\java\\javase"); f2.mkdir();*/ File srcFile=new File("e:\\jav.

2022-05-13 11:31:20 168

原创 java三人斗地主

public static void main(String[] args) { //创建HashMap键是编号 值是牌 HashMap<Integer, String> hm = new HashMap<Integer, String>(); //创建ArrayList 存储编号 ArrayList<Integer> array = new ArrayList<Integer>(); .

2022-05-11 17:10:12 155

原创 统计字符串里面字符出现顺序 和ArrayList嵌套HashMap

ArrayList嵌套HashMap/*ArrayList<HashMap<String,String>> array=new ArrayList<HashMap<String,String>>();HashMap<String,String> hm1=new HashMap<String, String>();hm1.put("sunce","daqiao");hm1.put("zhouyu","xiaoqiao");ar.

2022-05-11 14:49:27 97

原创 java Hashmap

HashMap的基本功能public static void main(String[] args) { Map<String,String> map=new HashMap<String, String>(); map.put("za","zz"); map.put("aaa","gg"); map.put("xx","yy"); /*System.out.println(map);

2022-05-10 16:23:35 133

原创 成绩排序TreeSet

测试类public static void main(String[] args) { TreeSet<Student> ts=new TreeSet<Student>(new Comparator<Student>() { @Override public int compare(Student s1, Student s2) { int num= s2.getSum(

2022-05-08 19:36:37 150

原创 Collection 集合

Arraylist的一些功能Collection<String> c=new ArrayList<String>() ; c.add("hello"); c.add("world"); System.out.println(c); c.remove("world"); c.clear(); c.contains(); c.isEmpty(); c.si

2022-05-07 21:44:24 216

原创 java字符串中的数据排序

public static void main(String[] args) { String s="91 27 46 38 50"; //把 字符串中的数字数据存储到一个int类型的数组里 String [] strArray=s.split(" "); for(int i=0;i<strArray.length;i++) { System.out.println(strArray[i]); } //把字符串数组转换为int数.

2022-05-07 09:35:34 1160

原创 Java 蓝球 乒乓教练 篮球乒乓运动员

Personpublic abstract class Person { private String name; private int age; public Person() { } public Person(String name, int age) { this.name = name; this.age = age; } public String getName() { ret

2022-05-06 09:01:22 205

原创 java 学生管理系统

分为两个类第一个是学生类 学生的定义public class Student { private String sid; private String name; private String age; private String address; public Student() { } public Student(String sid, String name, String age, String address) {

2022-05-03 17:21:04 527

原创 vector 容器

Vector 容器 构造函数void printVector(vector<int>& v){for(vector<int>::iterator it=v.begin();it!=v.end();it++){cout<<*it<<" ";}cout<<endl;}Vector容器和大小void printVector(vector<int>&...

2022-05-01 15:52:17 144

原创 c++,str容器,此为c++学习笔记

String容器void test01(){string s1;cout<<"str1="<<s1<<endl;const char* str="hello world";string s2(str);cout<<"str2="<<s2<<endl;string s3(s2);cout<<"str3="<<s3&l...

2022-04-30 09:29:13 152

原创 c++,模板

模板应用案例template<typename T>void swapl(T &a,T &b){T temp=a;a=b;b=temp;}template<typename T>void mysort(T arr[],int len){for(int i=0;i<len;i++){int max=i;for(int j=i+1;j&lt...

2022-04-29 16:35:54 1140

原创 c++,多态案例具体实现

C++,纯虚函数和抽象类class base{public://纯虚函数 只要有一个纯虚函数 这个类成为抽象类//抽象类特点 无法实例化对象//抽象类子类必须要重写父类中的纯虚函数 否则也属于抽象类virtual void func()=0;//变为了纯虚函数 就无法实例化对象};class son:public base{public:virtual void func(){cout...

2022-04-18 21:37:35 665

原创 c++ 多态

C++,多态的原理分析#include <iostream>#include<malloc.h>#include<stdio.h>#define MAX 1000using namespace std;//多态//前提有继承关系class animal{public://虚函数virtual void speak(){cout<<"动物在说话"<<endl...

2022-04-17 16:22:28 684

原创 c++ 类和对象 继承 菱形关系

#include <iostream>#include<malloc.h>#include<stdio.h>#define MAX 1000using namespace std;class animal{public:int m_age;};//利用虚继承 解决菱形继承的问题//加virtual 为虚继承 animal变为虚基类class sheep:virtual public animal{};class ...

2022-04-16 16:16:10 480

原创 c++,类和对象 继承 多部分

c++,类和对象,继承,基本语法#include <iostream>#include<malloc.h>#include<stdio.h>#define MAX 1000using namespace std;//继承实现页面//继承的好处 减少重复代码class Basepage{public: void header() { cout<<"首页登录"<<endl; } v...

2022-04-16 15:48:57 54

原创 c++,类和对象,继承,基本语法

#include <iostream>#include<malloc.h>#include<stdio.h>#define MAX 1000using namespace std;//继承实现页面//继承的好处 减少重复代码class Basepage{public: void header() { cout<<"首页登录"<<endl; } void footer() ...

2022-04-16 12:27:15 1170

原创 c++,函数调用运算符重载

#include <iostream>#include<stdlib.h>using namespace std;#include <stdio.h>#include<string>class My{public: void operator()(string test) { cout<<test<<endl; }};class Myadd{public: int o...

2022-04-14 16:15:38 433

原创 c++,重载关系运算符

#include <iostream>#include<stdlib.h>using namespace std;#include <stdio.h>#include<string>class Person{public: Person(string name,int age) { m_name=name; m_age=age; } bool operator==(Person &a...

2022-04-14 15:49:34 86

原创 c++,赋值运算符重载

本文为笔者学习c++,笔记而作#include <iostream>#include<stdlib.h>using namespace std;#include <stdio.h>#include<string>class Person{public: Person(int age) { m_age=new int(age); } ~Person() { if(m_a...

2022-04-14 12:47:34 106

原创 c++,递增运算符重载

#include <iostream>#include<stdlib.h>using namespace std;#include <stdio.h>#include<string>class My{ friend ostream &operator<<(ostream&cout,My myint);public: My() { m_num=0; } My &am...

2022-04-14 11:14:12 384

原创 c++,左移运算符重载

此为学习c++,笔记。#include <iostream>#include<stdlib.h>using namespace std;#include <stdio.h>#include<string>class Person{ friend ostream &operator<<(ostream &cout,Person &p);public: Person(int a,int b)...

2022-04-14 10:42:39 219

原创 c++,加号运算符重载

#include <iostream>#include<stdlib.h>using namespace std;#include <stdio.h>#include<string>class Person{public: Person operator+(Person &p) { Person temp; temp.m_a=this->m_a+p.m_a; temp....

2022-04-13 22:32:01 151

原创 c++,成员函数做友元

#include <iostream>#include<stdlib.h>using namespace std;#include <stdio.h>#include<string>class Building;class goodgay{public: goodgay(); void visit01(); void visit02(); Building *building;};class Building...

2022-04-13 21:48:25 350

原创 c++,类做友元

#include <iostream>#include<stdlib.h>using namespace std;#include <stdio.h>#include<string>class Building;class Goodgay{public: Goodgay(); void visit();private: Building*building;};class Building{ friend ...

2022-04-13 20:33:23 299

原创 c++,全局函数做友名

#include <iostream>#include<stdlib.h>using namespace std;#include <stdio.h>#include<string>class Building //建筑物的类{ //goodgay是Building的好朋友 friend void goodgay(Building *building);public: Building() { m_si...

2022-04-13 20:00:32 141

原创 c++,const

#include <iostream>#include<stdlib.h>using namespace std;#include <stdio.h>class Person{public: //每一个成员函数里面都有一个this指针 //在成员函数后面加const,修饰的是this指向,让指针指向的值也不可以修改 void showPerson() const { this->m_b=100; /...

2022-04-13 19:36:59 135

原创 c++,空指针

#include <iostream>#include<stdlib.h>using namespace std;class Person{public: void show() { cout<<"this class"<<endl; } void showperson() { if(this==NULL) { return; ...

2022-04-12 21:14:17 192

原创 c++,this指针概念

本文为自己学习c++,笔记,代码很多,没有解释,但此代码是正确的,如有需要,可以自己复制然后自己去学习琢磨。#include <iostream>#include<stdlib.h>using namespace std;class Person{public: Person(int age) { m_age=age; } Person &PersonAdd(Person &p) { ...

2022-04-12 20:59:14 80

原创 c++,只有非静态成员变量属于类的对象

#include <iostream>#include<stdlib.h>using namespace std;class Person{ int m_a;//非静态成员变量,属于类的对象上 static int m_b;//静态成员变量 ,不属于类对象上 void test1() //非静态成员函数 不属于类对象上 { } static void test11() //非静态成员函数 不属于类对象上 { ...

2022-04-12 20:21:57 335

原创 c++,静态成员函数

#include <iostream>#include<stdlib.h>using namespace std;//静态成员函数//所有的对象共享同一个函数//静态成员函数只能访问静态成员变量class Person{public: static void func() { m_a=100; //m_b=200; cout<<"static void func调用"<<endl;...

2022-04-12 20:04:36 219

原创 c++,类对象作为类成员

#include <string>#include <time.h>#include<stdio.h>#include<stdlib.h>//创建对象时 先创建phone 再创建person //析构时 先析构person 再析构phoneclass Phone{public: Phone (string pname) { m_pname=pname; } string m_pname;};...

2022-04-12 11:24:09 48

原创 c++对象特性,初始化列表

#include <iostream>using namespace std;#include <string>#include <time.h>#include<stdio.h>#include<stdlib.h>//编译器处理做浅拷贝 我们需要深拷贝class Person{public: /*Person(int a,int b,int c) { m_a=a; m_b=b;...

2022-04-12 10:58:45 188

原创 c++笔记,深拷贝与浅拷贝

#include <iostream>using namespace std;#include <string>#include <time.h>#include<stdio.h>#include<stdlib.h>//编译器处理做浅拷贝 我们需要深拷贝class Person{public: Person() { cout<<"Person的默认构造函数"<<endl;...

2022-04-11 22:37:29 58

原创 c++,构造函数调用规则

此代码是由bug 的#include <iostream>using namespace std;#include <string>#include <time.h>#include<stdio.h>#include<stdlib.h>//c++编译器 给每个类添加3个函数//自动提供三个函数 默认构造 析构函数 拷贝函数//我提供了有参构造函数 编译器就不提供无参构造了 但拷贝函数依然会提供//如果我们写了拷贝构造函数 ..

2022-04-11 19:55:26 40

原创 c++拷贝构造函数

#include <iostream>using namespace std;#include <string>#include <time.h>#include<stdio.h>#include<stdlib.h>//值传递的方式给函数参数传值// 用值的方式来返回局部的对象class Person{public: Person() { cout<<"默认构造函数调用"<&lt...

2022-04-11 18:09:59 51

原创 c++,构造函数的分类和应用

#include <iostream>using namespace std;#include <string>#include <time.h>#include<stdio.h>#include<stdlib.h>//无参构造(默认构造) 有参构造//按照类型分类class Person{public: Person() { cout<<"Pweson的构造函数调用"<&lt...

2022-04-11 16:58:11 80

原创 c++构造函数 析构函数

#include <iostream>using namespace std;#include <string>#include <time.h>#include<stdio.h>#include<stdlib.h>class Person{ //构造函数 可以有参数,可以发生重载 //没有返回值 //创建对象 编译器自动吊够 值吊钩一次public: Person() { ...

2022-04-11 13:50:35 35

原创 c++点与圆的距离

#include <iostream>using namespace std;#include <string>#include <time.h>#include <string>class Point{public: void setX(int x) { m_X=x; } int getX() { return m_X; } void setY(int y...

2022-04-11 13:27:35 276

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除