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

object as parameter

بدأه Luna Volver A salir في 14 ديسمبر 2013 · 3 رد · 480 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم ممكن تساعدوني تساعدوني في تصحيح هذا الكود هو لاستخدام الكائن كمتغير

class test         {
    int a,b;

    test(int i, int i0) {
        throw new UnsupportedOperationException("Not yet implemented");
    }
     boolean equal(test m){
      if(m.a==a&&m.b==b)
          return(true);
      else
          return(false);
  }
}
class obj{
   public static void main(String[] args){
    test x=new  test(3,5);
    test y=new test(3,5);
    test z=newt test(-1,5);
        boolean w=x equal(y);
    System.out.print(w);
    
     
    }
}
#2

ماهو المطلوب و ما هي مشكلتك بالتحديد ؟

#3

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

package project.web;

/**

*

* @author EG-WAFA

*/

class test {

int a, b;

test(int a, int b) {

this.a = a;

this.b = b;

}

boolean equal(test m) {

if (m.a == a && m.b == b) {

return (true);

} else {

return (false);

}

}

}

public class NewClass {

public static void main(String[] args) {

test x = new test(3, 5);

test y = new test(3, 5);

boolean w = x.equal(y);

System.out.println(w);

}

}

1
#4

انا مش فاهم ايه المشكلة معاك بالظبط .. بس شوف الفيديو ده او الفيديوهات  اللي بعده في الصفحة دي
http://codemasry.com/oop/jun13/videos/erF1FArJJBM

 

ان شاء الله يفيدك

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