Java抽象类中抽象方法的访问说明符

时间:2019-01-10 07:30:21

标签: java oop

当我声明不提供访问说明的Abstract方法时,默认情况下有什么访问说明?

using System.Drawing;
// ...
public bool IsImage(byte[] data)
{
  var dataIsImage = false;
  using (var imageReadStream = new MemoryStream(data))
  {
    try
    {
      using (var possibleImage = Image.FromStream(imageReadStream))
      {
      }
      dataIsImage = true;
    }
    // Here you'd figure specific exception to catch. Do not leave like that.
    catch
    {
      dataIsImage = false;
    }
  }

  return dataIsImage;
}

0 个答案:

没有答案