<?xml version="1.0"?>
<rss version="2.0">
   <channel>
      <title>Nhóm 3-Sợ lập trình-Java 29/9 by bryan trần</title>
      <link>https://padlet.com/tranthanhvu7939/i4wiaxixw0bm2vhv</link>
      <description></description>
      <language>en-us</language>
      <pubDate>2021-09-29 06:24:12 UTC</pubDate>
      <lastBuildDate>2023-02-16 11:18:56 UTC</lastBuildDate>
      <webMaster>hello@padlet.com</webMaster>
      <image>
         <url></url>
      </image>
      <item>
         <title>Câu 3:Có bao nhiêu cách ép kiểu trong Java? Cho ví dụ cụ thể.</title>
         <author>tranthanhvu7939</author>
         <link>https://padlet.com/tranthanhvu7939/i4wiaxixw0bm2vhv/wish/1777143361</link>
         <description><![CDATA[<div>Trong Java, có hai loại ép kiểu dữ liệu:<br><br></div><ol><li><strong>Nới rộng (widening):</strong> Là quá trình làm tròn số từ kiểu dữ liệu có kích thước nhỏ hơn sang kiểu có kích thước lớn hơn. Kiểu biến đổi này không làm mất thông tin.</li><li><strong>Thu hẹp (narrowwing):</strong> Là quá trình làm tròn số từ kiểu dữ liệu có kích thước lớn hơn sang kiểu có kích thước nhỏ hơn. Kiểu biến đổi này có thể làm mất thông tin.</li></ol><div>Ví dụ 1:</div><div><strong>public</strong> <strong>class</strong> Player {</div><div>&nbsp; &nbsp; <strong>public</strong> <strong>static</strong> <strong>void</strong> main(String[] args) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; <strong>int</strong> age= 100;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; <strong>long</strong> age1 = i;&nbsp; &nbsp; // không yêu cầu chỉ định ép kiểu</div><div>&nbsp; &nbsp; &nbsp; &nbsp; <strong>float</strong> age2 = l; &nbsp; // không yêu cầu chỉ định ép kiểu</div><div>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println("Tuổi cầu thủ kiểu Int: " + age);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println("Tuổi cầu thủ kiểu long: " + age1);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println("Tuổi cầu thủ kiểu float&nbsp; " + age2);</div><div>&nbsp; &nbsp; }</div><div>}<br>+output:<br>&nbsp;</div><pre>Tuổi cầu thủ kiểu Int: 19
Tuổi cầu thủ kiểu long: 19
Tuổi cầu thủ kiểu Float:  19.04</pre><div><br>Ví dụ 2:<br>//Khai báo lớp cầu thủ<br><strong>public</strong> <strong>class</strong> Player {</div><div>&nbsp; &nbsp; <strong>public</strong> <strong>static</strong> <strong>void</strong> main(String[] args) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; <strong>double</strong> age= 19.04;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; <strong>long</strong> age1= (<strong>long</strong>) age; // yêu cầu chỉ định kiểu dữ liệu (long)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; <strong>int</strong> age2= (<strong>int</strong>) age; // yêu cầu chỉ định kiểu dữ liệu (int)</div><div>&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println("Tuổi cầu thủ kiểu double: " + age);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println("Tuổi cầu thủ kiểu long: " + age1);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println("Tuổi cầu thủ kiểu Int:&nbsp; " + age2);</div><div>&nbsp;</div><div>&nbsp; &nbsp; }</div><div>}<br>+output:<br>&nbsp;</div><pre>Tuổi cầu thủ kiểu double: 19.04
Tuổi cầu thủ kiểu long: 19
Tuổi cầu thủ kiểu Int:  19</pre>]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/1037620434/cdc6909df0e2a9440fb22484f328f150/t_i_xu_ng.jpg" />
         <pubDate>2021-09-29 06:59:15 UTC</pubDate>
         <guid>https://padlet.com/tranthanhvu7939/i4wiaxixw0bm2vhv/wish/1777143361</guid>
      </item>
      <item>
         <title>Câu 5: Nhập xuất dữ liệu trong java, cho ví dụ:</title>
         <author>truyennguyendinh278</author>
         <link>https://padlet.com/tranthanhvu7939/i4wiaxixw0bm2vhv/wish/1777148288</link>
         <description><![CDATA[<div><strong>Nhập dữ liệu:<br></strong><br></div><div>+ Để nhập dữ liệu từ thiết bị nhập chuẩn (như bàn phím,…), Java cung cấp lớp <strong><em>Scanner</em></strong>.&nbsp; Để dùng lớp này, đầu tiên chúng ta phải tạo một đối tượng nhập và kết nối nó với thiết bị nhập chuẩn như đoạn mã sau:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br><br></div><div>-Scanner console = newScanner(System.in);<br><br></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<br><br></div><div>+Sau khi tạo đối tượng từ lớp <strong><em>Scanner</em></strong>, chúng ta sẽ sử dụng các phương thức của lớp <strong><em>Scanner</em></strong> để nhận dữ liệu từ thiết bị nhập chuẩn. Một số phương thức phổ biến:<br><br></div><div>-&nbsp; &nbsp; &nbsp; &nbsp; next(): Nhận vào một String token (nhận vào 1 từ đầu tiên thay cả câu)<br><br></div><div>-&nbsp; &nbsp; &nbsp; &nbsp; nextInt(): Nhận vào một số int<br><br></div><div>-&nbsp; &nbsp; &nbsp; &nbsp; nextLong(): Nhận vào một số long<br><br></div><div>-&nbsp; &nbsp; &nbsp; &nbsp; nextFloat(): Nhận vào một số float<br><br></div><div>-&nbsp; &nbsp; &nbsp; &nbsp; nextDouble(): Nhận vào một số double<br><br></div><div>-&nbsp; &nbsp; &nbsp; &nbsp; sc.nextLine(): Nhận vào một chuỗi String (Cả 1 câu)<br><br></div><div>-&nbsp; &nbsp; &nbsp; &nbsp; nextByte(): Nhận vào một byte<br><br></div><div>-&nbsp; &nbsp; &nbsp; &nbsp; nextBoolean(): Nhận vào một boolean<br><br></div><div><strong>Xuất dữ liệu:<br></strong><br></div><div>Trong các chương trình Java đầu tiên, chúng ta đã làm quen với đối tượng xuất dữ liệu đến thiết bị chuẩn (cụ thể là màn hình) là <strong><em>System.out</em></strong> và các phương thức xuất dữ liệu cơ bản là <strong><em>print</em></strong> và <strong><em>println<br></em></strong><br></div><div><strong><em>+</em></strong>Phương thức <strong><em>printf</em></strong> có thể được sử dụng theo hai cách là:<br><br></div><div><em>- System.out.printf(formatString);</em></div><div><em>- System.out.printf(formatString,argumentList);<br></em><strong>Ví dụ: <br></strong>Scanner sc = new Scanner(System.in);<br>System.out.printf(“ Ten doi bong:&nbsp; “ );<br>int a = sc.nextLine();<br>System.out.printf(“ So luong thanh vien:&nbsp; “ );<br>int b = sc.nextInt();</div><div>&nbsp;<br><br></div>]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/1037620434/a912a2656c633dec0ef86b166d6fecc6/images.png" />
         <pubDate>2021-09-29 07:01:35 UTC</pubDate>
         <guid>https://padlet.com/tranthanhvu7939/i4wiaxixw0bm2vhv/wish/1777148288</guid>
      </item>
      <item>
         <title>Câu 1: Trong Java có những kiểu dữ liệu nào? Cho ví dụ cụ thể.</title>
         <author>thaihoc2le2</author>
         <link>https://padlet.com/tranthanhvu7939/i4wiaxixw0bm2vhv/wish/1777150545</link>
         <description><![CDATA[<div>Trong Java có kiểu dữ liệu nguyên thủy và kiểu dữ liệu tham chiếu<br>&nbsp;* Kiểu dữ liệu nguyên thủy:&nbsp; &nbsp;<br>&nbsp;- Kiểu số nguyên&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; + <strong>byte</strong>: Vd:&nbsp; byte x = 1.&nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; + <strong>short</strong>: Vd: short x=10000.<br>&nbsp; &nbsp; +<strong> int</strong>: Vd: int h=2341234.<br>&nbsp; &nbsp; + <strong>long</strong>: Vd: long a = 100000L. <br> - Kiểu số thực:<br>&nbsp; &nbsp; + <strong>float</strong>: Vd: float a = 12.3f. <br>&nbsp; &nbsp; + <strong>double</strong>: Vd: double x = 676.7. <br>&nbsp; - char: Vd: char name ='A'. <br>&nbsp; - boolean: Vd: boolean hama = true.<br> * Kiểu dữ liệu tham chiếu:&nbsp; <br>&nbsp; &nbsp; - <strong>Array</strong>:<br>&nbsp; &nbsp; - <strong>class</strong>:<br>&nbsp; &nbsp; - <strong>interface:</strong></div><div>&nbsp; +Vd:ArrayList&lt;Player&gt;PlayerList&nbsp; //khai báo kiểu Player cho ArayList<br>+Vd2:public class Player{} //khai báo lớp Player</div>]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/1037620434/545db8cf9f77efdf2cef4efa3b1d3aff/unnamed.png" />
         <pubDate>2021-09-29 07:02:42 UTC</pubDate>
         <guid>https://padlet.com/tranthanhvu7939/i4wiaxixw0bm2vhv/wish/1777150545</guid>
      </item>
      <item>
         <title>Câu 4: Trong Java có những loại toán tử nào? Cho ví dụ minh họa.</title>
         <author>MinhChuong</author>
         <link>https://padlet.com/tranthanhvu7939/i4wiaxixw0bm2vhv/wish/1777174536</link>
         <description><![CDATA[<div>- Trong Java, chúng ta thường gặp các loại toán tử sau:<br>&nbsp; <strong>+ Toán tử gán</strong><br>&nbsp; &nbsp; &nbsp; &nbsp;-&gt; ví dụ: a = 1 sẽ gán giá trị 1 cho a.<br>&nbsp; <strong>+ Toán tử số học</strong><br>&nbsp; &nbsp; &nbsp; -&gt; ví dụ: toán tử + Toán tử cộng.<br>&nbsp; <strong>+ Toán tử một ngôi</strong><br>&nbsp; &nbsp; &nbsp; -&gt; ví dụ: toán tử +&nbsp; Chỉ định giá trị&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;không âm.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; <strong>+ Toán tử so sánh</strong><br>&nbsp; &nbsp; &nbsp; -&gt; ví dụ: toán tử <strong>== </strong>(<em>So sánh bằng</em>)&nbsp; So sánh giá trị của toán hạng bên trái và toán hạng bên phải có bằng nhau hay không. Nếu có thì kết quả trả về true, ngược lại trả về false.<br>&nbsp; <strong>+ Toán tử luận lý điều kiện</strong><br>&nbsp; &nbsp; &nbsp; -&gt; ví dụ: toán tử&nbsp; &amp;&amp;&nbsp; Phép toán luận lý và<strong> (</strong><strong><em>AND</em></strong><strong>)</strong> trên 2 giá trị, Kết quả trả về true khi cả hai đều đúng.<br>&nbsp; <strong>+ Độ ưu tiên giữa các toán tử trong Java</strong><br>&nbsp; &nbsp; &nbsp; -&gt; ví dụ: thứ tự 1: Các toán tử 1 ngôi: +, -, ++, --</div>]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/1037620434/ce313a7ff8282dd3483236dd80076a15/t_i_xu_ng.png" />
         <pubDate>2021-09-29 07:14:02 UTC</pubDate>
         <guid>https://padlet.com/tranthanhvu7939/i4wiaxixw0bm2vhv/wish/1777174536</guid>
      </item>
      <item>
         <title>Câu 2:Phân biệt biến và hằng trong Java. Cho ví dụ minh họa. Cần lưu ý gì khi đặt tên?</title>
         <author>tranthanhvu7939</author>
         <link>https://padlet.com/tranthanhvu7939/i4wiaxixw0bm2vhv/wish/1777195945</link>
         <description><![CDATA[<div>***Biến***<br><strong><em>Biến</em></strong> là các định nghĩa từ bạn, nó giúp hệ thống tạo ra các vùng nhớ để lưu giữ các giá trị trong ứng dụng. <em>Mỗi biến đều có một kiểu dữ liệu riêng</em>, kiểu dữ liệu này sẽ báo cho hệ thống biết biến đó có <em>“độ lớn”</em> bao nhiêu. Độ lớn của biến sẽ cho biết khả năng lưu trữ giá trị của biến. Bạn sẽ được nắm rõ về độ lớn lưu trữ của mỗi loại biến ở bài học này. Ngoài ra thì mỗi biến còn phải được bạn đặt một cái tên giúp hệ thống có thể quản lý, truy xuất dữ liệu trong vùng nhớ của biến đó.<br><br>Đặt Tên Cho Biến:<br>Quy Tắc 1</div><div><strong><em>Ký tự bắt đầu của tên biến phải là chữ cái, hoặc dấu gạch dưới (_), hoặc ký tự đô la ($)</em></strong>. Ví dụ cho việc đặt tên biến đúng như sau.<br>Vd: int age; //dung cu phap<br><br>Quy Tắc 2</div><div><strong><em>Không được có khoảng trắng giữa các ký tự của biến</em></strong>. Ví dụ đặt tên biến như sau là sai.</div><div>Vd:Khai báo tuổi của cầu thủ<br>&nbsp; &nbsp; int 5age; //sai cu phap<br><br>Quy Tắc 3</div><div><strong><em>Không chứa ký tự đặc biệt bên trong tên biến như</em></strong><em> </em><strong><em>!@#%^&amp;*</em></strong>. Ví dụ đặt tên biến như sau là sai.<br>Vd: Khai báo tên cầu thủ<br>String n@me; //sai cu phap;<br><br>Quy Tắc 4</div><div><strong><em>Không được đặt tên biến trùng với keyword</em></strong>. Keyword là các từ khóa mà ngôn ngữ Java dành riêng cho một số mục đích của hệ thống.<br>Vd: int final;<br><br><br></div><h1>***Hằng số***</h1><div><strong><em>Hằng Số</em></strong> trong tài liệu tiếng Anh gọi là <strong><em>const</em></strong>, viết tắt của từ <em>constant</em>. Hằng cũng tương tự như biến, nhưng đặc biệt ở chỗ nếu một biến được khai báo là hằng thì nó sẽ <em>không được thay đổi giá trị trong suốt chương trình</em>.<br>Để khai báo một hằng số, bạn cũng khai báo giống như biến nhưng thêm <strong><em>final</em></strong> vào trước khai báo.<br>Vd:<br><strong>final</strong> <strong>float</strong> money = 23,23;</div><div><strong>final</strong> <strong>char</strong> FIRST_CHARACTER = 'a';</div><div><strong>final</strong> <strong>int</strong> age_nghi_huu = 38;</div>]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/1037620434/d1852cba8bbdee15387f2d7274d554f1/feature_green_4.png" />
         <pubDate>2021-09-29 07:23:31 UTC</pubDate>
         <guid>https://padlet.com/tranthanhvu7939/i4wiaxixw0bm2vhv/wish/1777195945</guid>
      </item>
   </channel>
</rss>
