By GokiSoft.com| 20:19 17/06/2022|
Java Basic

[Source Code] Tìm hiểu Java & cài đặt môi trường & Tìm hiểu Java Core - C2108L


Tổng quan nội dung kiến thức: - Core: - Khai báo biến - Toán tử & biểu thức điều kiện - Mệnh đề điều kiện - Vòng lặp (for, while, do .. while, foreach) - Function - Array - Nội dung kiến thức mới: - OOP - List (ArrayList, Vector, Hashmap) - Labda - Debug trong dự án - Exception - Kiến thức mới - Java swing - Java FX ===================================================== Nội dụng buổi học hôm nay: - Giới thiệu về ngôn ngữ lập trình Java - Thiết lập môi trường phát triển - Tạo dự án - Deploy dự án -> gửi cho KH - Code 1 vài dự án cở bản Khai báo biến Toán tử Mệnh đề điều kiện Vòng lặp




#Test03.java


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package lesson01;

/**
 *
 * @author Diep.Tran
 */
public class Test03 {
    public static void main(String[] args) {
        System.out.println("OKOK");
        System.out.println("Xin chao");
    }
}


#Test02.java


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package lesson01;

/**
 *
 * @author Diep.Tran
 */
public class Test02 {
    public void showMenu() {
        System.out.println("Xin chao");
        System.out.println("OKOK");
    }
}


#Test01.java


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package lesson01;

import java.util.Scanner;

/**
 *
 * @author Diep.Tran
 */
public class Test01 {
    public static void main(String[] args) {
        System.out.println("Hello World!!!");
        System.out.println("Ho ten: Tran Van A");
        System.out.println("Gioi tinh: Nam");
        
        int x = 10;
        int x1, x2;
        boolean k = true;
        float t, t2 = 10;
        double d = 10.5f;
        char c = 'A';
        String str = "Xin chao";
        System.out.println("str = " + str);
        System.out.println("x = " + x + ", c = " + c);
        
        System.out.format("\nstr = %s, c = %c, t2 = %f", str, c, t2);
        
        final int kk = 10;//Khai bao bien hang
        
        //Nhap du lieu tu ban phim
        Scanner tenbien = new Scanner(System.in);
        
        //Nhap so nguyen
        System.out.println("Nhap x = ");
//        x = tenbien.nextInt();
        x = Integer.parseInt(tenbien.nextLine());
        
        System.out.println("Nhap t = ");
//        t = tenbien.nextFloat();
        t = Float.parseFloat(tenbien.nextLine());
        
        System.out.println("Nhap str = ");
//        tenbien.nextLine();
        str = tenbien.nextLine();
        
        System.out.println("x = " + x + ", t = " + t + ", str = " + str);
    }
}


#pom.xml


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.aptech</groupId>
    <artifactId>C2108L</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>lesson01.Test01</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


Tags:

Phản hồi từ học viên

5

(Dựa trên đánh giá ngày hôm nay)