الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

ما هو الخطأ في هذا ال Class

مغلق
بدأه MaaSTaaR في 15 ديسمبر 2005 · 2 رد · 492 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

مشروع "عيون العرب" Arabeyes.org

السلام عليكم ...

قمت بكتابة الكلاس التالي :

/*
	By The Name Of ALLAH
	--------------------
*/

public class BBS
{
	public String name;
	public String creator;
	public String website;

	public BBS(String name, String creator, String website)
	{
  this.name 	 =  name;
  this.creator  =  creator;
  this.website  =  website;
	}

	public int GetInfo()
	{
  System.out.println("Bulletin Board System Name is " + this.name);
  System.out.println("Bulletin Board System programme is " + this.creator);
  System.out.println("More infromation about " + this.name + " at " + this.website);
  System.out.println("=========================================================");
  
  return 0;
	}
}

و قمت بتخزين الـ class في ملف بإسم BBS.java , و من خلال الملف example.java قمت بإستدعاء الـ class من اجل استخدامه في الكود التالي :

/*
	By The Name Of ALLAH
	--------------------
*/

package BBS;

public class example 
{
	public static void main(String[] args) 
	{
  BBS MySmartBB  = new BBS("MySmartBB","MaaSTaaR","http://www.mysmartbb.com");
  BBS vBulletin  = new BBS("vBulletin","Jelsoft Team","http://www.vbulletin.com");
  BBS phpBB  = new BBS("phpBB","phpBB Team","http://www.phpbb.com");
  
  MySmartBB.GetInfo();
  vBulletin.GetInfo();
  phpBB.GetInfo();
	}
}

و لكن عندما اقوم بعمل compile للكود , تظهر لي الاخطاء التاليه :

example.java:7: cannot resolve symbol
symbol : class  BBS
location: class  BB.example
  BBS MySmartBB	= new BBS();
  ^

ما هو سبب هذا الخطأ ؟

تم تعديل هذه المشاركة بواسطة MaaSTaaR في 15 ديسمبر 2005 في 19:27

#2

أول خطا:

الملف الاول مافيه باكيج بعكس الثاني اللي هو داخل باكيج!! هل انتبهت لهذي المشكله؟ هل متأكد من اسماء الباكيج؟

ثاني خطأ:

أكتب public void GetInfo() واحذف اخر سطر return 0

#3

بسم الله

أولاً:

the method has to be void

وبدون

return

وبدون thisفي

System.out.println("Bulletin Board System Name is " + name);

public voidGetInfo()

{

System.out.println("Bulletin Board System Name is " + this.name);

System.out.println("Bulletin Board System programme is " + this.creator);

System.out.println("More infromation about " + this.name + " at " + this.website);

System.out.println("=========================================================");

}

هذا الموضوع مغلق.

مواضيع مشابهة