How to extract .war files in java? ZIP vs JAR

If you look at the JarFile API you’ll see that it’s a subclass of the ZipFile class. The jar-specific classes mostly just add jar-specific functionality, like direct support for manifest file attributes and so on. It’s OOP “in action”; since jar files are zip files, the jar classes can use zip functionality and provide additional utility.

What is the difference between local and instance variables in Java?

One extra thing I can think of: Instance variables are given default values, i.e., null if it’s an object reference, and 0 if it’s an int. Local variables don’t get default values, and therefore need to be explicitly initialized (and the compiler usually complains if you fail to do this).

Adding image to JFrame

There is no specialized image component provided in Swing (which is sad in my opinion). So, there are a few options: As @Reimeus said: Use a JLabel with an icon. Create in the window builder a JPanel, that will represent the location of the image. Then add your own custom image component to the JPanel … Read more

char initial value in Java

Typically for local variables I initialize them as late as I can. It’s rare that I need a “dummy” value. However, if you do, you can use any value you like – it won’t make any difference, if you’re sure you’re going to assign a value before reading it. If you want the char equivalent … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)