华清远见-重庆中心Java基础阶段总结

这篇博客总结了Java的基础知识,包括变量的定义与访问、基本数据类型如int、long、char和boolean,数据转换、算术与逻辑运算符,程序的顺序、分支和循环结构。还介绍了数组的使用、排序和扩容,以及编程过程中的注意事项和常见面试题。
摘要由CSDN通过智能技术生成

目录

1.Java变量

1.1什么是变量

1.2变量的定义

1.2.1语法 

1.2.2语法规则

1.3变量的访问

2.Java中的基本数据类型

2.1整型 int

 2.2长整型 long

2.3double & float

2.4char

2.4.1字符类型实质上是一个16位无符号整数;可以参与运算

2.4.2char赋值:

2.4.3转义字符

2.4.4boolean

3.数据转换

3.1自动数据类型转换(隐式转换)

3.2强制数据转换

4.运算符

4.1算术运算符

4.2关系运算符

4.3逻辑运算符

4.4三目运算符

5.程序的结构

5.1顺序结构

5.2分支结构

5.2.1  if

5.1.2  if.... else.....

5.1.3 if.....else.....if....

5.1.4 switch.....case......

5.3循环

5.3.1 for循环

5.3.2 while循环

5.3.3 do....while 

5.3.4 死循环

5.3.5 break&continue

6.数组

6.1数组的使用

6.1.1什么是数组

6.1.2数组的定义及初始化

6.2数组排序

6.2.1冒泡排序

6.2.2数组排序

6.3数组复制

6.4数组的扩容

7.总结:

7.1编码过程

7.2错题

7.3 面试题

7.3.1 在JAVA中,如何跳出当前多重嵌套循环?

7.3.2JDK和JRE有什么区别?

7.3.3=、==、和equls的区别

7.3.4string是基础数据类型吗?基础的数据类型有哪些?

7.3.5如何实现数组和List之间的转换?


1.Java变量

1.1什么是变量

变量是指在内存中的一块存储空间,用于存储程序运算过程中需要用到的数据

1.2变量的定义

1.2.1语法 

变量类型 变量名

int age;

1.2.2语法规则

1.在声明变量的同时初始化变量;或者先声明变量,然后在对他进行初始化

int age = 12;
//int age;
//age=12;

2.可以一起声明多个类型相同的变量,用逗号将变量分隔开

int age,price=12,id;

3.变量的命名规则

---可以有字母、数字 "_"  和 "$" 组成

---不能以数字开头

---不能使用Java中的关键字

---如果Java变量由多个英语单词组成,需要使用“驼峰命名法”,第一个单词的首字母小写,其余的单词首字母大写

---变量名不能重复

1.3变量的访问

可以对变量中的值进行存取操作,在进行赋值时,应当给变量正确的数据类型,否则会产生编译错误

2.Java中的基本数据类型

类型名称字节空间类型说明范围
byte一个字节(8位)存储一个字节数据-128~127
short二个字节(16位)-23768~32767
int四个字节(32位)存储整数-2147483648~2147483647
long八个字节(64位)存储长整数-2^63 ~ 2^63-1
float四个字节(32位)存储浮点数精度0.0
double八个字节(64位)存储双精度浮点数精度0.0
char二个字节(16位)存储一个字符\u0000~\uffff  (十进制:0~65535)
boolean一个字节(8位)true / false

2.1整型 int

1.连个int类型的数相除,结果还是整数

2.溢出:运算的结果如果超过了整数能表示的最大范围,会发生溢出;

正数过大溢出,结果变为负数;负数过小溢出,结果变为正数;反复循环

int a=10, b=3;
int c=a/b;   //c的值为3

//溢出
int x=y=1500000000;
int total=x+y;  //total的值超出了int类型的范围,所得的结果不为x+y的真正结果

 2.2长整型 long

1.long类型的数据,需要在数据后面加一个l或L

2.System.currentTimeMillis(),可以获取从1970.1.1日零时至今的毫秒数,返回结果为long

2.3double & float

2.3.1浮点类型

1.浮点类型包含double和float

2.浮点类型的默认类型为double类型

3.float类型的数据,需要在数据后面加f或者F

double a1=3.5;
//float a2=3.5;//编译错误,Java中的浮点数默认是double类型,不能将double直接赋值给float
float a2=3.5f;  //在数据后面加f或F,使该数据成为float类型

2.4char

2.4.1字符类型实质上是一个16位无符号整数;可以参与运算

 char a ='A';
 int b=a+32;   //b的值为97

2.4.2char赋值:

1.Unicode编码赋值   

2.整数赋值范围(0~65535)

char a ='A';  //A
char b=65;  //A
char c='\u0045';  //E  

2.4.3转义字符

转义符含义Unicode值
\b退格\u0008
\n换行\u000a
\r回车\u000d
\t制表符(tab)\u0009
\"双引号\u0022
\'单引号\u0027
\\反斜杠\u005c
char a ='A';
int b=a+32;
System.out.println(a +"\n"+b); 
//输出 A 
//97 

2.4.4boolean

1.适用于逻辑运算,一般在程序流程中作条件判断

2.boolean类型的值只有两个:true、false;不能用其他的代替

3.不能与整数类型做转换

public class test3 {
    public static void main(String[] args) {
       while (true){
           Scanner sc = new Scanner(System.in);
           System.out.println("请输入年份:");
           int year = sc.nextInt();
           if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0){
               System.out.println(year+"是闰年");
           }else {
               System.out.println(year+"不是闰年");
           }
       }
    }
}

3.数据转换

3.1自动数据类型转换(隐式转换)

小类型自动转换为大类型

int a = 12;
float b = 3;
System.out.println(a / b);  //4.0

3.2强制数据转换

从大类型转到小类型,需要强制转换,可能会有精度损失或溢出

 float a= (float) 3.6;
//浮点数默认为double类型,不能将double类型的直接赋值a;需要强制转换

 int b=(int) a; //a是float类型,不能存在int类型的变量中
 System.out.println(a); //3.6
 System.out.println(b); //3

4.运算符

4.1算术运算符

算术运算符包含:+ 加、 - 减 、 * 乘 、  /  除、 % 取余  、 ++ 自增 、  -- 自减

注意: 

1.++ 自增 、  -- 自减写在变量的前面,变量先自增或自减1,再参与运算

2.++ 自增 、  -- 自减写在变量的后面,变量先参与运算,然后再自增或自减1

package day3;
/*
算术运算符  +  -  *   /   %    ++  --
符号: 正:+    负:-
*/
//能做算术运算的类型:byte、short、int、long、char、float、double
//不能做算术运算的类型:boolean,其他复杂类型
public class suanshuDemo {
    public static void main(String[] args) {
        //1、加、减、乘法运算;运算结果以大范围数据为准
        long data1 = 10;
        double data2 = 3.5;
        double data3 = data1 + data2;//13.5
        System.out.println(data3);

        //2、除法运算
        System.out.println(data1 / 5 * data2);//7.0
        System.out.println(data3 = 1 / 2);
        System.out.println(1 / 2.0);

        //3、取余运算
        long m = data1 % 3;  // 1
        boolean k = m == 0;   //false
        System.out.println(k);

        //4、++(--)运算
        int i = 5;
        i++;   //i=6
        System.out.println(i);
        int j = ++i;
        System.out.println("j=" + j + ",i=" + i);//j=7;i=7
        j = i++;
        System.out.println("j=" + j + ",i=" + i);//j=7;i=8

        //5、符号
        int m1 = -5;  //符号
        int m2 = +5;  //正号


    }
}

4.2关系运算符

1.Java中的关系运算符包含:>大于  <小于  ==等于   >=大于等于     <=小余等于     !=不等于

2.关系运算的结果都是boolean类型(true/false) 

package day3;

/*
关系运算:大于>   大于等于>=   等于== 小于<  小于等于<=   不等于!=
能做算术运算的类型:byte、short、int、long、char、float、double
不能做算术运算的类型:boolean,其他引用类型
*
 * */
public class relationDemo {
    public static void main(String[] args) {
        //1.关系运算   结果为boolean类型
        int a = 100;
        int b = 100;
        boolean r = a > b;// false
        char c = '中';
        char c1 = '国';
        if (c > c1) {//判断的是编码值的大小
            System.out.println(true);
        } else {
            System.out.println(false);
        }

        //2.等于==
        int a1 = 10;
        int a2 = 20;
        //int a3=a1==a2;  //编译错误,先进行条件运算,结果为false,然后再赋值,boolean类型不能赋值给除boolean类型外的其他类型的变量


        //3.练习: 定义两个整数,找到最大的那个
        boolean b1 = a1 >= a2;   //赋值运算符的优先级最低,先做其他运算,最后赋值
        if (b1) {
            System.out.println("a1大,为:" + a1);
        } else {
            System.out.println("a2大,为:" + a2);
        }


    }
}

4.3逻辑运算符

1.逻辑运算符包含:&& 逻辑与     ||  逻辑或      !  逻辑非

2.逻辑运算的结果也是boolean类型

package day3;
/*
逻辑运算:与&&   或||    非!
能做逻辑运算的类型:boolean
不能做逻辑运算的类型:除boolean类型外的类型
运算规则:与&&(全真则真,有假则假)    或||(全假则假,有真则真)   非!(取反)

短路逻辑:   &&  ||  当能够判断运算结果时,就不在执行后面的表达式
不短路逻辑: &   |   每个参与运算的表达式都要执行
* */

public class luojiDemo {
    public static void main(String[] args) {
        //1.运算
        boolean b1 = true;
        boolean b2 = true;
        boolean b3 = false;
        boolean b4 = b1 && b2;  //true
        System.out.println(b4);
        b4 = b1 && b2 && b3;    //false
        System.out.println(b4);
        b4 = b1 || b3;          //true
        System.out.println(b4);
        b4 = b1 || b2 || b3;    //true
        System.out.println(b4);
        b4 = !b3;               //true
        System.out.println(b4);
        b4 = !(b1 || b2);       //false
        System.out.println(b4);
        b4 = !(b1 && b3) || b3; //true
        System.out.println(b4);

        //2.短路逻辑 &&  ||
        int a = 3, b = 5;
        boolean b5 = a > b && a++ > 1;
        //a>b是false   &&运算的结果确定为false,所以后面的a++ > 1的表达式不会被执行到,因此a的值还为3
        b5 = a < b || a++ > 1;   //遇到true,就不往后执行,a为3
        b5 = a > b || a++ > 1;   //a为4
        //3.不短路逻辑  &   |
        boolean b6 = a > b & a++ > 1;
        //a>b是false   &&运算的结果确定为false,但是后面的a++ > 1的表达式还是会被执行,因此a的值还为4
        System.out.println(a);//4
        b6 = a > b | a++ > 1;

    }
}

4.4三目运算符

1.语法格式:  表达式1?表达式2:表达式3 ;表达式1为true则执行表达式2,否则执行表达式3

package day3;
/*
 * 1.赋值运算 =
 * 2.+=  -=  *=  /=  %= 扩展运算符
 * 3."+"用于字符串拼接
 * 4.三目运算   条件?表达式1:表达式2      条件为true执行表达式1.否则执行表达式2
 * */

import java.util.Scanner;

public class otherYunSuanDemo {
    public static void main(String[] args) {
        //1.扩展的赋值运算符
        int k = 10;
        k += 20;
        System.out.println(k); //30
        k /= 4;
        System.out.println(k); //7

        //2."+"做字符串拼接
        String str = "hello";
        System.out.println(k + k + str);  //"14hello"
        System.out.println(k + str + k);  //"7hello7"
        System.out.println(str + k + k);  //"hello77"
        System.out.println(str + (k + k));  //"hello14"
        System.out.println((str + k) + k + k);  //"hello777"
        System.out.println(str + k + k);  //"hello77"
        System.out.println(k + k + k + k);  //28

        //3.三目运算
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入年龄:");
        int age = sc.nextInt();
        String info = age <= 18 ? "未成年人" : "成年人";
        System.out.println("你现在" + age + "岁,你是" + info);


    }
}

5.程序的结构

5.1顺序结构

程序顺序执行

public class Main {
    public static void main(String[] args) {
        int a=10;
        int b =5;
        b+=a/b;  //b=7
        b=10;
        System.out.println(a+","+b);
    }
}

5.2分支结构

5.2.1  if

语法规则   if(条件判断){ //语句1 }  结果为true,执行语句1;值为false,则不执行语1;然后顺序执行后面的语句

5.1.2  if.... else.....

5.1.3 if.....else.....if....

/*
输入一个1~7的整数,输出对应的星期几
*/
import java.util.Scanner;

public class IfEleseManyDemo1 {
    public static void main(String[] args) {
        while (true) {
            System.out.println("请输入一个数:");
            int num = new Scanner(System.in).nextInt();
            if (num > 0 && num < 8) {
                if (num == 1) {
                    System.out.println("星期一");
                } else if (num == 2) {
                    System.out.println("星期二");
                } else if (num == 3) {
                    System.out.println("星期三");
                } else if (num == 4) {
                    System.out.println("星期四");
                } else if (num == 5) {
                    System.out.println("星期五");
                } else if (num == 6) {
                    System.out.println("星期刘");
                } else {
                    System.out.println("周日");
                }

            } else {
                System.out.println("请输入一个1~7的整数");
            }
        }
    }
}

5.1.4 switch.....case......

语法规则   

switch (变量){
    case 值1:
       //变量的值等于值1时需要执行的语句
        break;  //不加break,当变量的值满足条件时从满足条件时开始,会一直执行,直到遇到第一个break时停止switch语句;
    case 值2:
        //变量的值等于值12时需要执行的语句
        break;
    default:
        //变量的值都不等于case的值时需要执行的语句
       
package day4;

import java.util.Scanner;

public class SwitchCaseDemo {
    public static void main(String[] args) {
       while (true){
           System.out.println("请输入一个1~7的整数:");
           int num=new Scanner(System.in).nextInt();
           switch (num){
               case 1:
                   System.out.println("星期一");
                   break;
               case 2:
                   System.out.println("星期二");
                   break;
               case 3:
                   System.out.println("星期三");
                   break;
               case 4:
                   System.out.println("星期四");
                   break;
               case 5:
                   System.out.println("星期五");
                   break;
               case 6:
                   System.out.println("星期六");
                   break;
               case 7:
                   System.out.println("星期日");
                   break;
               default:
                   System.out.println("你输入的数据未定义");
           }
       }
    }
}

5.3循环

5.3.1 for循环

1.for循环三要素:循环变量初始化;循环条件,循环变量的改变

2.for循环语法:

for(循环变量初始化;循环条件;循环变量的改变){

   循环体

}

 //计算1+1/2+1/3+.....+1/888的和
        double n=0;//装浮点数的数据
        for (int i = 1; i < 889; i++) {
            n+=1.0/i;
        }
        System.out.println(n);

3.for循环的特殊写法


        int j = 1;
        for (; j <=10; j++) {
            System.out.println("你跑了"+j+"圈,还剩"+(10-j)+"圈");
        }

        for (;;){
            if (j<=10){
                System.out.println(j);
            }else {
                break;  //结束循环
            }
            j++;
        }

        for (;;j++){
            if (j<=10){
                System.out.println(j);
            }else {
                break;  //结束循环
            }
        }

5.3.2 while循环

1.while语法规则:

  while(循环条件){

     循环体

}

        //3.输出1~100中能被3整除的数
        num=1;
        while (num<101){
            if (num%3==0){
                System.out.println(num);
            }
            num++;
        }

5.3.3 do....while 

1.do.....while的语法规则:

do{

   循环体

}while(循环条件)

2.与while循环的区别:

---while循环先判断,然后执行循环体

---do....while先执行循环体,然后在判断

        //输入密码解锁手机,最多5次机会
       int pwd;
        int count=0;
        do {
            if (count==5){
                System.out.println("密码错误次数过多");
                //break;  结束本次循环
                return; //结束整个程序的运行
            }
            System.out.println("请输入密码");
            pwd=sc.nextInt();
            count++;
        }while (pwd!=123456);
        System.out.println("解锁成功");

5.3.4 死循环

语法:

1.while(true){

  循环体

}

2.do{

    循环体

}while (true);

3.for(; ;)  

5.3.5 break&continue

1.break可用于循环语句(终止循环)或switch语句(遇到break停止switch语句)中;

2.continue只能用于循环语句中,跳过当前循环,执行下一次循环

package day5;
//随机出10道题,记录用户的考试分数,每题10分

import java.util.Scanner;

public class TestDemo {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int score = 0;

        for (int i = 1; i < 11; i++) {
            int x = (int) (Math.random() * 10);
            int y = (int) (Math.random() * 10);
            System.out.println(x + " + " + y + " =");
            System.out.println("请输入你的答案:");
            int answer = sc.nextInt();
            if (answer == -1) {
                continue;  //输入-1跳过本题
            } else if (answer == -2) {
                break;  //输入-2结束答题
            } else {
                if (answer == x + y) {
                    score += 10;
                    System.out.println("恭喜你,答对了,您的分数为:"+score);
                } else {
                    System.out.println("很遗憾,您的分数为:"+score);
                }
            }
        }
        System.out.println("你最终的得分为:" + score);
    }
}

5.3.6循环嵌套

---外层走一次,内层全走完

---循环层数越少越好

//九九乘法表
public class JiuJiuDemo {
    public static void main(String[] args) {
        for (int i = 1; i < 10; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print(i +" × "+ j +" = "+(i*j)+"\t");//输出不换行
            }
            System.out.println(); //换行
        }
    }
}

6.数组

6.1数组的使用

6.1.1什么是数组

数组:一组相同数据类型的数据组成的集合

6.1.2数组的定义及初始化

1.声明数组:    数据类型[ ]   数组名;数据类型[ ]   数组名=new 数据类型[数组长度];                 数据类型[ ]   数组名=new 数据类型[]{数据1,数据2};

2.数组初始化:  数组名=new 数据类型[数组长度];数组名={数据1,数据2};

3.数组元素的默认值:int类型:0;浮点型:0.0;char:空白字符;boolean:false;String:null

public class ArrayTestDemo {
    public static void main(String[] args) {
        //1.创建一个长度为10的整形数组
        int[] list = new int[10];
        //2.给数组的每个元素重新赋值
        for (int i = 0; i < list.length; i++) {
            list[i] = (int) (Math.random() * 100);
        }

        //正序
        System.out.println("正序");
        for (int i = 0; i < list.length; i++) {
            System.out.print(list[i] + "\t");
        }
        System.out.println();
        //逆序
        System.out.println("逆序");
        for (int i = list.length - 1; i >= 0; i--) {
            System.out.print(list[i] + "\t");
        }
        System.out.println();

        //找最大值和最小值
        int max=list[0];
        int min=list[9];
        for (int i = 0; i < list.length; i++) {
            if (list[i]>max){
                min=max;
                max=list[i];
                for (int j = 0; j <=i; j++) {
                    if (list[j]<min){
                        min=list[j];
                    }
                }
            }
        }
        System.out.println("最大值:"+max+",最小值:"+min);

    }


}

6.2数组排序

6.2.1冒泡排序

public class ArrayTestDemo {
    public static void main(String[] args) {
        //1.创建一个长度为10的整形数组
        int[] list = new int[10];
        //2.给数组的每个元素重新赋值
        for (int i = 0; i < list.length; i++) {
            list[i] = (int) (Math.random() * 100);
        }

        //正序
        System.out.println("正序");
        for (int i = 0; i < list.length; i++) {
            System.out.print(list[i] + "\t");
        }
        System.out.println();
        //逆序
        System.out.println("逆序");
        for (int i = list.length - 1; i >= 0; i--) {
            System.out.print(list[i] + "\t");
        }
        System.out.println();

        //找最大值和最小值
        int max=list[0];
        int min=list[9];
        for (int i = 0; i < list.length; i++) {
            if (list[i]>max){
                min=max;
                max=list[i];
                for (int j = 0; j <=i; j++) {
                    if (list[j]<min){
                        min=list[j];
                    }
                }
            }
        }
        System.out.println("最大值:"+max+",最小值:"+min);

    }


}

6.2.2数组排序

Arrays.sort(数组名)--jdk提供的排序方法

public class ArrayCopyList {
    public static void main(String[] args) {
        int[] arr = {90,20,150,40,50};
        int[] arr1=new int[10];
        Arrays.sort(arr);

    }
}

6.3数组复制

System.arraycopy(要复制的源数组,复制到新数组的开始位置,新数组,从源数组的复制开始位置,复制元数个数)
package day6;

import java.util.Arrays;
public class ArrayCopyList {
    public static void main(String[] args) {
        int[] arr = {90,20,150,40,50};
        int[] arr1=new int[10];
        Arrays.sort(arr);
        System.arraycopy(arr,2,arr1,2,3);

    }
}
输出20	40	50	90	150	
0	0	50	90	150	0	0	0	0	0	

6.4数组的扩容

扩容方法:扩容后的新数组=Arrays.copyOf(原数组名,扩展后的数组长度)

public class ArrayCopyDemo {
    public static void main(String[] args) {
        //创建一个长度为4的字符串数组
        String[] strs = new String[4];  //默认为null
        for (int i = 0; i < strs.length; i++) {
            strs[i] = "tom" + i;
        }
        //将数组类型转换为字符串类型
        String str = Arrays.toString(strs);
        System.out.println(str);

        //数组扩容
        //strs[4]="tom4";  //运行时错误  数组下标越界异常
        //增加数组长度   strs原数组  strs.length+1新的数组长度
        strs = Arrays.copyOf(strs, strs.length + 1);
        strs[4]="tom5";
        System.out.println(Arrays.toString(strs));
    }
}

7.总结:

7.1编码过程

1.在定义变量或使用变量的时候一定要注意数据的类型

2.float类型的数据应该在后面加f或F;long类型的数据在后面加 l 或L

3.在使用switch语句时,记得加break

7.2错题

1.编译运行以下程序后,关于输出结果的说明正确的是:
       public  static  void  main(String  args[  ]){
             int  x=4;
             System.out.println(“value  is  “+ ((x>4) ? 99.9 :9));
       }

//三目运算结果的数据类型为参与运算的数据类型范围大的

A.输出结果为:value is 99.99     B.输出结果为:value is 9

C.输出结果为:value is 9.0    D.编译错误

2.Java语言中字符串“学Java”所占的内存空间是:  //一个字符占两个字节

A. 6个字节 B. 7个字节 C. 10个字节 D.11个字节

3.下列代码段编译和运行的结果是:
  public static void main(String[] args) {
      for (int i = 0; i <= 10; i++) {

         if (i > 6)
              break;
       }
  System.out.println(i);   

//输出语句不在for循环里,变量i是在for循环里面定义的变量,在for循环外不可用
 }

A.输出 6 B.输出 7 C.输出 10 D.编译错误

7.3 面试题

7.3.1 在JAVA中,如何跳出当前多重嵌套循环?

1.break结束循环;

2.continue结束当前循环,进行下一次循环


7.3.2JDK和JRE有什么区别?

1.JRE主要包含:java类库的class文件(都在lib目录下打包成了jar)和虚拟机(jvm.dll);

2.JDK主要包含:java类库的 class文件(都在lib目录下打包成了jar)并自带一个JRE。


7.3.3=、==、和equls的区别

1. =是赋值;

2. == 用来比较8种基本数据的值是否相等或者用来比较引用类型的内存地址的值是否相等

3.equls是一个方法,用来比较内存地址值是否相等


7.3.4string是基础数据类型吗?基础的数据类型有哪些?

不是;

基本数据类型有8种:char 、int、 long 、double 、float  、boolean  、byte、  short


7.3.5如何实现数组和List之间的转换?

1.List转数组

方法一:使用for循环,将List的数据加到数组中;

方法二:使用toArray()方法   数组类型  数组名=集合名.toArray(new 数组类型[ 集合的长度]);

2.数组转集合

方法一:使用for循环, 遍历数组,将数组中的数据通过 集合名.add()添加到集合中

方法二:使用aList()方法    List<数据类型> list = Arrays.asList(数组名);

方法三:使用Collections.addAll()方法    Collections.addAll(集合名,数组名);

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值