java - ImageIO cannot resolve to a type -


just simple programming question.

import java.awt.image.bufferedimage; import java.io.file; import java.io.ioexception;   public class readthepic {     public static void main(string[] args){         bufferedimage img = null;         try {             img = imageio.read(new file("strawberry.jpg"));         } catch (ioexception e) {         }      } } 

error: imageio cannot resolved type. why?thanks

import javax.imageio.imageio; 

imageio not accessible due restriction on requiered library

you forgot import class.
add import javax.imageio.imageio after other imports , should work.


Comments

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -