💡 มารู้จัก Class สำหรับจัดการ String เจ๋ง ๆ ในภาษา Java กันเถอะ !! นั่นคือเจ้า StringBuilder นั่นเองจ้าาา !!
.
มีรายละเอียดยังไงบ้างงง ไปดูกันนนน !!~~
.
✨ StringBuilder เป็น Class สำหรับจัดการ String เพื่อให้เราสามารถแก้ไข แทรก หรือต่อ String ได้อย่างมีประสิทธิภาพนั่นเอง
.
🔸 Syntax
public final class StringBuilder
extends Object
implements Serializable, CharSequence
.
🖥️ ตัวอย่างฟังก์ชัน
StringBuilder () - สร้าง StringBuilder มีความจุเริ่มต้นคือ 16 อักขระ
StringBuilder(int capacity) - สร้าง StringBuilder ตามความยาวที่ระบุ
StringBuilder(CharSequence seq) - สร้าง Object StringBuilder ด้วยลำดับอักขระที่ระบุ
StringBuilder(String str) - สร้าง Object StringBuilder เริ่มต้นด้วย String
.
📑 ตัวอย่างการใช้งาน
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
public class GFG1 {
public static void main(String[] argv)
throws Exception
{
//StringBuilder()
StringBuilder str
= new StringBuilder();
str.append("BorntoDev");
System.out.println("String = "
+ str.toString());
//StringBuilder(CharSequence)
StringBuilder str1
= new StringBuilder("BorntoDevBorntoDevBorntoDev");
System.out.println("String1 = "
+ str1.toString());
//StringBuilder(capacity)
StringBuilder str2
= new StringBuilder(10);
System.out.println("String2 capacity = "
+ str2.capacity());
//StringBuilder(String)
StringBuilder str3
= new StringBuilder(str1.toString());
System.out.println("String3 = "
+ str3.toString());
}
}
.
🔹 Output
String = BorntoDev
String1 = BorntoDevBorntoDevBorntoDev
String2 capacity = 10
String3 = BorntoDevBorntoDevBorntoDev
.
หวังว่าจะเป็นประโยชน์กับเพื่อน ๆ นะคร้าบบบบบ 🥰
.
borntoDev - 🦖 สร้างการเรียนรู้ที่ดีสำหรับสายไอทีในทุกวัน
同時也有1部Youtube影片,追蹤數超過667萬的網紅Travel Thirsty,也在其Youtube影片中提到,Sate Tuna Fish Pieces and Sate Minced Tuna with Coconut Paste grilled over charcoal. Satay, modern Indonesian and Malay spelling of sate, is a dish o...
java public class 在 โปรแกรมเมอร์ไทย Thai programmer Facebook 的最佳貼文
ขออัพเดตโครงการ หลักสูตรโค้ดดิ้งสำหรับเด็กไทย อันนี้สรุปให้ตามข่าวที่ รมช.ศธ. พูด
1) การส่งเสริมการโค้ดดิ่งให้กับเด็กไทย
มีอยู่ในนโยบายของภาครัฐที่ประกาศต่อสภา
2) หลักสูตรโค้ดดิ่งเริ่มต้นในเดือน พ.ย.
เปิดเทอมหน้านี้ที่จะถึง ก็พร้อมลุยกันเลย
แต่จะเริ่มนำร่องกับเด็กระดับชั้น ป.1-ป.3 ก่อน
3) การเรียนโค้ดดิ้งตามหลักสูตร
จุดประสงค์ไม่ได้สอนเด็กเป็น #โปรแกรมเมอร์
4) แต่เรียนเพื่อให้เด็กคิดมีตรรกะ ให้คิดเป็น คิดเป็นระบบ
นำไปใช้ในชีวิตประจำวันได้ คิดสร้างสรรค์ สร้างสิ่งใหม่ๆ ในชีวิตได้
5) รัฐบาลไม่ได้บังคับทุกโรงเรียนต้องเปิดหลักสูตรนี้
เงื่อนไขต้องให้โรงเรียนสมัครมาเอง
ผู้อำนวยการ และคุณครูต้องอยากสอน ไม่ได้บังคับ
....แต่น่าจะลืมถามนักเรียนว่าจะเอาด้วยไหม (อันนี้แซวเล่นนะ)
6) เดือน ต.ค. จะอบรมครูทั่วประเทศ 1,000 คน
สำหรับคุณครูอบรบ 3 วัน
ส่วนผู้อำนวยการก็ต้องเข้าอบรบด้วย แต่อบรบแค่ 1 วัน
7) ถามว่าหลักสูตรตอนนี้พร้อมหรือยัง?
ต้องบอกว่าพร้อมตั้งนานแล้ว
แต่ตามข่าวยังไม่ได้นำไปปฏิบัติใช้จริง
+++++
ความเห็นส่วนตัวผมเองก็ยังงงๆ
มันจะต่างกับหลักสูตร "วิชาวิทยาการคำนวณ" ของกระทรวงศึกษา
ที่สอนตั้งแต่ ป.1- ยันโน่นถึงม.6
มันต่างกันยังไง????
.
ส่วนเนื้อหาการเรียนและการสอนจะเป็นอย่างไรนั้น?
อันนี้ต้องติดตามตอนต่อไป ......
ถ้าใครมีน้องๆ ป.1 ถึง ป.3.
เปิดเทอมหน้าลองถามน้องดูได้ เรียนแล้วเป็นไง
.
###########
อีกอย่างหนึ่ง ขอให้ความรู้เพิ่มเติม
เห็นบางคอมเมนต์ไม่เห็นด้วยที่ใช้คำว่าโคดดิ้งสอนเด็ก
เพราะโปรแกรมเมอร์อาจคุ้นเคยกับการโค้ดดิ้งเป็น Text
.
ต้องเข้าใจว่าในระดับปฐมเวลาสอนโค้ดดิ้งเด็ก
เขาไม่ได้ใช้ภาษาอย่างเช่น C++, Java, PHP มาสอน
.
ภาษาอย่าง Python มีสอนอยู่ในหลักสูตร
ที่มีอยู่ในตำราเรียนวิชาวิทยาการคำนวณ
จะเริ่มสอนในชั้น ม.ต้น ในประถมยังก่อน
(แต่จะให้ทางโรงเรียนเลือกสอนระหว่าง Python หรือ Scratch)
.
ในระดับเด็กประถมอย่างมากสุด
จะสอนเขียนโปรแกรม จะใช้เป็น Scratch
เวลาฝรั่งบอกว่าสอนโค้ดดิ้งให้กับเด็กเล็กวัยปฐม
ก็จะใช้ Scratch เป็นส่วนใหญ่ เพื่อเน้นตรรกะ และกระบวนการคิด
.
ซึ่งมันเป็นการใช้บล็อกคำสั่ง ควบคุมตัวละครในเกม
...โดยเน้นไปที่ ฝึกตรรกะ ฝึกกระบวนการคิด
...แต่ถ้าถามว่าใช้ Scratch สร้างเกมง่ายๆ ได้ไหม ก็ตอบว่าทำได้นั่นแหละ
.
สำหรับ Scratch ฝรั่งมันก็บอกว่า เป็นภาษาโปรแกรมมิ่งเหมือนกัน
แต่เป็นชนิดหนึ่งเรียกว่า visual programming language (VPL)
เป็นภาษาภาพ ใช้ภาพสร้างโปรแกรมขึ้นมา
.
ในการทำงานจริงถ้าใครเคยอยูภาคอุตสาหากรรม
คงรู้จัก LabView ซึ่งใช้ควมคุมฮาร์ดแวร์ PLC
มันก็ใช้ภาษาภาพนี้แหละเขียนโปรแกรมควบคุม
ไม่ต้องมาเขียน Text ด้วยมือ ที่เขียนคำผิด ก็มีผลต่อโปรแกรม
.
จึงไม่น่าจะแปลกอะไรที่ฝรั่งมันจะบอกว่าใช้ Scratch สอน
เพื่อปูทักษะ ฝึกพื้นฐานตรรกะ
ก็เหมาตีรวมว่าเป็นการโค้ดดิ้งไปเลย
กลายเป็นคำที่ขายได้ หรือคำการตลาด เวลาใช้โปรโมต
.
---
ที่มาข่าว
https://www.youtube.com/watch?v=SHXRHbdpcnY
สรุปโดย โปรแกรมเมอร์ไทย thai programmer
I would like to update the program of the teaching course for Thai kids. This one is summarized according to the news at the NCO. .. Speak.
1) Promotion of codeing for Thai children.
contained in public sector policy declared to congress
2) Code wording course starts in Feb. Y.
This next semester will be ready. Let's fight
But to start the pilot with the grade school kid 1-P. 3 first
3) Study code following the course.
Purpose doesn't teach kids to be #programmers.
4) But study to make kids think logically. Think as a system.
Apply everyday, get creative, create new things in life.
5) Government is not mandatory. All schools have to open this course.
Conditions must be applied for the school itself.
The director and the teacher must want to teach, not mandatory.
.... But I should forget to ask students whether they want to take it too (this one is teasing.)
6) The month of the year. .. I will train 1,000 teachers nationwide.
For the teacher. 3 days of training.
The director also has to go to the battle, but the training is only 1 days.
7) Ask if the course is now ready?
I have to say I have been ready for a long time
But according to the news, it hasn't been implemented yet.
+++++
My personal opinion is still confused.
It will be different to the ′′ Computational Science ′′ course of the Ministry of Education.
I have taught since the first grade. 1-Solstice to university. 6
What is the difference????
.
What would the content and teaching be?
This one must follow the next episode......
If anyone has kids in P.O. 1 to the P.O. 3.
Open next semester. Ask my sister. How was she studying?
.
###########
One more thing, more knowledge.
I see some comments that I don't agree with using the word ′′ code ′′ to teach kids ′′
Because programmers may be familiar with Text code rolling.
.
I need to understand that in premiere time teaching child code.
He doesn't use language like C ++, Java, PHP to teach.
.
Languages like Python are taught in the course.
Available in computational science textbooks.
Gonna start teaching in middle school class Early in primary school.
(But the school will choose between Python or Scratch)
.
At the highest grade kid level
I will teach programming. I will use it as Scratch.
When a foreigner says that she teaches code to young children in early age.
Scratch will be mostly used to focus on logic and thought process.
.
It's a character control command block in a game.
... With focus on practicing logic, practicing thought processes.
... But if you ask me whether I can use Scratch to create an easy game, I will say I can do it.
.
For Scratch, it says it's a programming language too.
But it's a kind called visual programming language (VPL)
In visual language, use image to create a program.
.
In real work, if anyone has ever lived in the industry.
I would know LabView which uses PLC hardware control.
It's using this image language. Programming. Control.
Don't have to write Text with hand written words. It affects the program.
.
It shouldn't be strange that a foreigner says that they use Scratch to teach.
To pave the skills, practice the basic logic.
Well, it's just a code.
Become a selling word or marketing word when you use to promote it.
.
---
News Source
https://www.youtube.com/watch?v=SHXRHbdpcnY
Summary by Thai Thai Thai programmerTranslated
java public class 在 โปรแกรมเมอร์ไทย Thai programmer Facebook 的最佳解答
ดูออเจ้าตอนจบแล้ว 😚 ก็ย้อนมาดูบทเรียนการสร้างคลาสแบบ Inheritance เข้าใจง่าย ๆ
-ถ้าให้คลาสพ่อชื่อ "พ่อเดช"
-คลาสแม่ชื่อ "แม่การะเกด"
-ส่วนคลาสลูกชื่อ "ครอบครัว" ที่ขยายมาจากพ่อกับแม่ ทำให้สืบทอดสมาชิกมาทั้งหมด 6 คน ได้แก่ พ่อ,แม่ และลูกทั้ง 4 คน ทว่ามันสืบทอดมาจากสองคลาส (มากกว่า 1 คลาส) จึงเป็นการสร้างคลาสแบบ Multiple Inheritance
🤔 จากตัวอย่างนี้ ลองมาเขียนคลาสใน Java แต่ทว่าใน Java ไม่รองรับ multiple inheritance จึงเลี่ยงมาใช้ interface แทน ได้ดังตัวอย่าง
interface Pho_date { // พ่อเดช
public void do_father();
}
interface Mae_garagade { // แม่การะเกด
public void do_mother();
}
public class Family implements Pho_date, Mae_garagade {
@Override
public void do_father(){ /*.....*/ }
@Override
public void do_mother() { /*.....*/ }
public void do_child1() { /*.....*/ }
public void do_child2() { /*.....*/ }
public void do_child3() { /*.....*/ }
public void do_child4() { /*.....*/ }
}
java public class 在 Travel Thirsty Youtube 的最佳貼文
Sate Tuna Fish Pieces and Sate Minced Tuna with Coconut Paste grilled over charcoal.
Satay, modern Indonesian and Malay spelling of sate, is a dish of seasoned, skewered and grilled meat, served with a sauce. Satay may consist of diced or sliced chicken, goat, mutton, beef, pork, fish, other meats, or tofu; the more authentic version uses skewers from the midrib of the coconut palm frond, although bamboo skewers are often used. These are grilled or barbecued over a wood or charcoal fire, then served with various spicy seasonings.
Satay originated in Java, Indonesia. It is available almost anywhere in Indonesia, where it has become a national dish. It is also popular in many other Southeast Asian countries, including Malaysia, Singapore, Brunei, Thailand, the Philippines, East Timor as well as in Suriname and the Netherlands, as Indonesia and Suriname are former Dutch colonies.
Satay is a very popular delicacy in Indonesia; the country's diverse ethnic groups' culinary arts (see Indonesian cuisine) have produced a wide variety of satays. In Indonesia, satay can be obtained from a traveling satay vendor, from a street-side tent-restaurant, in an upper-class restaurant, or during traditional celebration feasts. In Malaysia, satay is a popular dish—especially during celebrations—and can be found throughout the country. In Southern Philippines it is known as satti.
Close analogues are yakitori from Japan, shish kebab from Turkey and the Middle East, shashlik from the Caucasus, chuanr from China, and sosatie from South Africa.
Indonesia is the home of satay (known as sate in Indonesian and pronounced similar to the English "satay"), and satay is a widely renowned dish in almost all regions of Indonesia; it is considered the national dish and one of Indonesia's best dishes. Satays, in particular, are a staple in Indonesian cuisine, served everywhere from street carts to fine dining establishments, as well as in homes and at public gatherings. As a result, many variations have been developed throughout the Indonesian Archipelago.
Sate Lilit is a satay variant from Balinese cuisine. This satay is made from minced pork, fish, chicken, beef, or even turtle meat, which is then mixed with grated coconut, thick coconut milk, lemon juice, shallots, and pepper. The spiced minced meat is wound around bamboo, sugar cane or lemongrass sticks, it is then grilled on charcoal. Unlike skewers of other satay recipes which is made narrow and sharp, the bamboo skewer of sate lilit is flat and wide. This wider surface allowed the minced meat to stick and settle. The term lilit in Balinese and Indonesian means "to wrap around", which corresponds to its making method to wrapping around instead of skewering the meat.
