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

cannot resolve sympol class Scanner

مغلق
بدأه aahd2xxx في 10 نوفمبر 2006 · 1 رد · 637 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

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

الأخوة الأعزاء .. أنا بحاول أعمل test class لل method باستخدام ال Scanner و لكن يطلع لي هذا ال error

D:\......................................GCD.java:2: cannot resolve symbol

symbol : class Scanner

location: package util

import java.util.Scanner;

^

D:\.....................................GCD.java:53: cannot resolve symbol

symbol : class Scanner

location: class GCD

Scanner sc = new Scanner (System.in);

^

D:\......................................GCD.java:53: cannot resolve symbol

symbol : class Scanner

location: class GCD

Scanner sc = new Scanner (System.in);

^

3 errors

Process completed.

و هذا هو الكود ....

import java.util.Scanner;
public class GCD

{
  public static int gcd(int n, int k)
  {
	int r;		  //  the remainder
	r = n % k;
	if (r == 0)
	  return k;
	else
	  return gcd(k, r);
  }
	public static void main(String[] args)
	{
		Scanner sc = new Scanner (System.in);
				System.out.print("Enter the first integer: ");
		int first = sc.nextInt();
				System.out.print("Enter the second integer: ");
		int second = sc.nextInt();
				int Gcd = gcd(first, second);
		System.out.println("the greatest common divisor = "+Gcd);
		}

}

مع العلم إنى عرفت أسوي ال test class باستخدام ال BufferedReader

و دمتم ...

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

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