<?xml version="1.0"?>
<rss version="2.0">
   <channel>
      <title>Team.05 - Lập trình Java - 2/10 by Bùi Nguyễn Nhật Tân</title>
      <link>https://padlet.com/buinguyennhattan12122002/bilg38hxzt380lhc</link>
      <description>Được tạo với một nụ cười</description>
      <language>en-us</language>
      <pubDate>2021-10-02 00:43:45 UTC</pubDate>
      <lastBuildDate>2023-09-18 09:33:15 UTC</lastBuildDate>
      <webMaster>hello@padlet.com</webMaster>
      <image>
         <url></url>
      </image>
      <item>
         <title>Phân công:</title>
         <author>hothikieulinh1407</author>
         <link>https://padlet.com/buinguyennhattan12122002/bilg38hxzt380lhc/wish/1785307728</link>
         <description><![CDATA[<div>1.Linh<br>2.Ngân<br>3.Tân <br>4.Danh<br>5.Nhung<br><br></div>]]></description>
         <enclosure url="" />
         <pubDate>2021-10-02 00:50:03 UTC</pubDate>
         <guid>https://padlet.com/buinguyennhattan12122002/bilg38hxzt380lhc/wish/1785307728</guid>
      </item>
      <item>
         <title>1. Các kiểu dữ liệu trong Java</title>
         <author>hothikieulinh1407</author>
         <link>https://padlet.com/buinguyennhattan12122002/bilg38hxzt380lhc/wish/1785321498</link>
         <description><![CDATA[<div><strong><em>I.Primitive:</em></strong></div><div><strong>1. Boolean</strong></div><div>- <strong>boolean </strong>là kiểu dữ liệu đơn giản nhất, nó có kích thước 1 <strong>bit</strong>. Nó có 2 giá trị là <strong>true </strong>và <strong>false</strong>.<br>Ví dụ:</div><div>// Khai báo một biến có tên 'active', kiểu boolean.<br>// Giá trị là true.<br>boolean active = true;<br>hoặc nếu giá trị false:<br>boolean active = false;<br><strong>2. Char<br></strong>Kiểu dữ liệu này có thể dùng để lưu kí tự hoặc số nguyên không âm, có kích thước 2 byte. Giá trị nhỏ nhất là '\u0000' (hoặc 0) và giá trị lớn nhất là '\uffff' (hoặc 65,535).<br>Ví dụ: Khai báo một kí tự trong tên: <br>&nbsp; &nbsp; &nbsp; &nbsp;char name ='A' <br><strong>3. Byte</strong><br>- Kiểu dữ liệu này dùng để lưu số nguyên (âm hoặc dương), có kích thước 1 byte. Giá trị nhỏ nhất là -128 (-2^7) và giá trị lớn nhất là 127 (2^7 -1) Giá trị mặc định là 0.</div><div><br>Ví dụ: khai báo giá trị của một số nguyên:<br>&nbsp; &nbsp; byte x = 1 , byte y = -1<br><strong><br>4. Short</strong></div><div>Dùng để lưu dữ liệu có kiểu số nguyên, nhưng kích cỡ lớn hơn byte. Bộ nhớ kiểu dữ liệu này là 2 byte. Giá trị nhỏ nhất là -32,768 (-2^15) và giá trị lớn nhất là 32,767 (2^15 -1) Giá trị mặc định là 0.</div><div><br>Ví dụ: khai báo kích cỡ của một dãy nào đó:<br>&nbsp; &nbsp; &nbsp;short t = 50, short z = -50<br><strong><br>5. Int</strong></div><div>Đây cũng là kiểu dữ liệu dùng để lưu kiểu số nguyên, kích cỡ 4 byte (lớn hơn byte và short). Giá trị nhỏ nhất là - 2,147,483,648.(-2^31) và giá trị lớn nhất là 2,147,483,647 (2^31 -1) Thông thường, int được sử dụng làm kiểu dữ liệu mặc định cho các giá trị nguyên. Giá trị mặc định là 0.</div><div><br>Ví dụ: khai báo tuổi của 2 người bằng kiểu số nguyên<br>&nbsp; &nbsp; &nbsp;int a = 18, int b = 20<br><strong><br>6. Long</strong></div><div>Kiểu dữ liệu dùng để lưu số nguyên lớn nhất là Long. Kích cỡ của nó lên đến 8 byte. Giá trị nhỏ nhất là -9,223,372,036,854,775,808.(-2^63) và lớn nhất là 9,223,372,036,854,775,807 (2^63 -1) Kiểu này được sử dụng khi cần một dải giá trị rộng hơn int. Giá trị mặc định là 0L.</div><div><br>Ví dụ: khai báo dữ kiệu của một số nhập vào<br>&nbsp; &nbsp;long a = 100000L, int b = -100000L</div><div><strong><br>7. Float</strong></div><div>Float là kiểu dữ liệu lưu số thực, kích cỡ 4 byte. Giá trị mặc định là 0.0f. Kiểu Float không bao giờ được sử dụng cho các giá trị chính xác như currency.</div><div><br>Ví dụ: khai báo điểm trung bình của một sinh viên:<br>float jpy = 9.222<br><strong><br>8. Double</strong></div><div>Double cũng là kiểu dữ liệu để lưu số thực, nhưng kích thước dữ liệu lớn hơn Float. Bộ nhớ của nó là 8 byte. Thông thường, kiểu dữ liệu này được sử dụng làm kiểu mặc định cho các giá trị decimal. Kiểu double cũng không bao giờ được sử dụng cho các giá trị chính xác như currency. Giá trị mặc định là 0.0d.</div><div><br>Ví dụ: cần nhập vào một diện tích của mảnh đất:<br>&nbsp; &nbsp; &nbsp;double ct = 676.7<br><strong>II. Non-primitive:</strong></div><ul><li>String: kiểu dữ liệu này khai báo cho một dãy kí tự bao gồm chữ cái a-z và kí tự số 0-1 và các kí tự đặc biệt</li></ul><div>Ví dụ: String a="abcde";<br>hoặc nhập dữ kiệu họ tên:<br>String b="Ho Thi Kieu Linh"</div><div><br><br></div><div><strong><br><br><br></strong><br><br></div>]]></description>
         <enclosure url="" />
         <pubDate>2021-10-02 01:06:48 UTC</pubDate>
         <guid>https://padlet.com/buinguyennhattan12122002/bilg38hxzt380lhc/wish/1785321498</guid>
      </item>
      <item>
         <title></title>
         <author>buinguyennhattan12122002</author>
         <link>https://padlet.com/buinguyennhattan12122002/bilg38hxzt380lhc/wish/1785323018</link>
         <description><![CDATA[<div><strong>Câu 3:</strong><br>Có 2 cách ép kiểu:</div><ul><li>Ép kiểu dữ liệu đối với dữ liệu nguyên thủy (Primitive Data Types)</li><li>Ép kiểu dữ liệu tham chiếu (Reference Types)</li></ul><div>Trong ép kiểu dữ liệu đối với dữ liệu nguyên thủy thì có 2 cách:</div><ul><li>Nới rộng (widening)</li><li>Thu hẹp (narrowwing)</li></ul><div>Ví dụ:</div><ul><li>Nới rộng : Chuyển đổi int thành long.</li></ul><pre>public class Test{
       public static void main(String[] args) {
            int a = 10;
            long b = a;
            System.out.println(b);
       }
}</pre><ul><li>Thu hẹp: Chuyển đổi double sang int.</li><li><pre>public class Test{
       public static void main(String[] args) {
            double a = 10.55;
            int b = (int)a;
            System.out.println(b);
       }
}</pre></li></ul>]]></description>
         <enclosure url="" />
         <pubDate>2021-10-02 01:08:37 UTC</pubDate>
         <guid>https://padlet.com/buinguyennhattan12122002/bilg38hxzt380lhc/wish/1785323018</guid>
      </item>
      <item>
         <title>Câu 5:</title>
         <author>knhung1602</author>
         <link>https://padlet.com/buinguyennhattan12122002/bilg38hxzt380lhc/wish/1785326962</link>
         <description><![CDATA[<div><strong><br>1.Nhập dữ liệu từ bàn phím:<br></strong>- Java cung cấp lớp <strong><em>Scanner</em></strong></div><div><strong>&nbsp; &nbsp; &nbsp; &nbsp; </strong>Scanner sc = <strong>new</strong> Scanner(System.in);</div><div>- Để sử dụng lớp <strong><em>Scanner</em></strong> chúng ta cần <strong><em>import</em></strong> lớp <strong><em>Scanner</em></strong> đến dự án</div><div>&nbsp; &nbsp; &nbsp; &nbsp; <strong>import</strong> java.util.Scanner;</div><div><strong>2.Xuất dữ liệu ra màn hình:</strong></div><div><strong>- Cú pháp: System.out.println (“nội dung cần in”);</strong></div><div><strong>3. Ví dụ:</strong></div><div>import java.util;.Scanner;</div><div>&nbsp;</div><div>public class Input {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Public static void main(String[] args) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Scanner sc =new Scanner (System.in);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(“Hello “+ sc.next());</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div>}</div>]]></description>
         <enclosure url="" />
         <pubDate>2021-10-02 01:13:10 UTC</pubDate>
         <guid>https://padlet.com/buinguyennhattan12122002/bilg38hxzt380lhc/wish/1785326962</guid>
      </item>
      <item>
         <title>Câu 2</title>
         <author></author>
         <link>https://padlet.com/buinguyennhattan12122002/bilg38hxzt380lhc/wish/1785338703</link>
         <description><![CDATA[<div>2<strong>.Phân biệt biến và hàm trong java</strong></div><div>&nbsp;Biến</div><div>1.<mark>Khái niệm:</mark> Biến là một liên kết tới một vị trí trên bộ nhớ (memory) để chứa dữ liệu.</div><div>Vd:</div><div>int a =10; &nbsp;</div><div>ð Ta có: kiểu dl: int , tên biến: a, giá trị: 10;</div><div>Sinhvien sv = new Sinhvien( );</div><div>ð Ta có: kiểu dl: Sinhvien , tên biến: sv , giá trị: Sinhvien( );</div><div>2.<mark>Cú pháp khai báo biến </mark>:</div><ul><li>kieu_du_lieu ten_bien = gia_tri;</li></ul><div><br></div><div>Trong đó:</div><div>·&nbsp; &nbsp; &nbsp; &nbsp; kieu_du_lieu : là kiểu dữ liệu mà biến có thể lưu trữ (kiểu số, kiểu văn bản…) tương ứng với int, long, String… trong Java</div><div>·&nbsp; &nbsp; &nbsp; &nbsp; ten_bien : tên của biến do người lập trình đặt&nbsp;</div><div>·&nbsp; &nbsp; &nbsp; &nbsp; gia_tri giá trị của biến, giá trị của biến phải nằm trong phạm vi của kiểu dữ liệu.</div><div>3<mark>.Quy tắc đặt tên biến:</mark></div><ul><li>Biến tên phải tuân theo quy tắc chung ở trên được đặt theo <strong>quy tắc lạc đà</strong>&nbsp; ( <em>Camel Case</em> ): đó là chữ cái đầu tiên của từ đầu tiên phải viết thường và chữ cái đầu tiên của các từ tiếp theo phải viết hoa.</li></ul><div>&nbsp;ví dụ :diemTrungBinh.<br><br></div><ul><li>Ngoài ra, trong một số trường hợp, biến tên phải thể hiện dữ liệu kiểu của biến đó.&nbsp;</li></ul><div>Ví dụ: biến có kiểu là Danh sách thì nên đặt tên là studentList, biến có kiểu là Set thì nên đặt tên là studentSet, biến có kiểu là Map thì nên đặt tên là studentMap, biến có kiểu là Array thì nên đặt tên là studentArray ,…<br><br></div><div><strong>Hàm</strong>&nbsp;<br><br></div><div>1.<strong><mark>Cú pháp của hàm:</mark></strong><br><br></div><div>modifier returnType nameOfMethod (Parameter List) {</div><div>// method body</div><div>}</div><div><strong>Trong đó:</strong></div><div>&nbsp;Modifiers (tạm dịch là phạm vi sửa đổi và truy cập)</div><div>§&nbsp; returnType: kiểu dữ liệu trả về</div><div>§&nbsp; nameOfMethod: tên của hàm(method)</div><div>§&nbsp; Parameter :là các tham số đầu vào của hàm(có thể có nhiều tham số với nhiều kiểu dữ liệu khác nhau)</div><div>§&nbsp; // body: là các mã code bên trong hàm</div><div>§&nbsp; &nbsp;</div><div>Ví dụ: Viết hàm tính tổng 2 chữ số a và b<br><br></div><div>public static int sum(int a, int b) {</div><div><strong>return</strong> a + b;</div><div>}</div><div><mark>Thao tác với hàm</mark><br><br></div><div>+Hàm có trả về kết quả<br><br></div><div>Ví dụ:<br><br></div><div>public <strong>class</strong> Main {</div><div>public static int sum(int a, int b) {</div><div><strong>return</strong> a + b;</div><div>}</div><div>public static <strong>void</strong> main(String[] args) {</div><div>int sum = sum(2,5);</div><div>System.out.println(sum);</div><div>}</div><div>}</div><div>&nbsp;<br><br></div><div>+Hàm không có trả về kết quả<br><br></div><div>Ví dụ:<br><br></div><div>public static <strong>void</strong> printHello() {</div><div>System.out.println("Hello");</div><div>}</div>]]></description>
         <enclosure url="" />
         <pubDate>2021-10-02 01:26:47 UTC</pubDate>
         <guid>https://padlet.com/buinguyennhattan12122002/bilg38hxzt380lhc/wish/1785338703</guid>
      </item>
      <item>
         <title></title>
         <author>danh08999</author>
         <link>https://padlet.com/buinguyennhattan12122002/bilg38hxzt380lhc/wish/1785341213</link>
         <description><![CDATA[]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/1367510982/296eb41f8bff6b2e8a73e6cb2d9c12fb/c_u_4.docx" />
         <pubDate>2021-10-02 01:29:32 UTC</pubDate>
         <guid>https://padlet.com/buinguyennhattan12122002/bilg38hxzt380lhc/wish/1785341213</guid>
      </item>
   </channel>
</rss>
