no-arg constructor คืออะไร

โพสแรกหลังโดนขโมยโดเมน
August 15, 2013
บุคลิกภาพคุณเป็นแบบไหน
February 9, 2014

วันนี้ครับ เพิ่งเจอ error ตัวหนึ่ง หน้าตาประมาณนี้

com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions con.iamnooyu.user does not have a no-arg default constructor

ก็มานั่งงงอยู่กับประโยคหลังสุด “does not have a no-arg default constructor” ถึงกับต้องค้นหาเลยว่ามันหมายความว่าอะไร

บอกตามตรงเลยนะ ผมนั่งงงเกือบครึ่งชั่วโมง (กับความฉลาดน้อยของตัวเอง) เนื่องจากที่ทำงานแบนเวบไซต์แบบชนิดแหลกลาน ( stackoverflow ยังเข้าไม่ได้เลย T^T) จึงต้องพึ่งพา 3g ที่อืดๆแทน – -”

จึงได้ข้อสรุปมาดังนี้

เจ้า no-arg constructor คือ constructor ที่ไม้ต้องการการ return ข้อมูลกลับ นั่นเอง

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.