Primitive Data Types: A primitive data type is pre-defined by the programming language. The size and type of variable values are specified, and it has no additional methods.uses a small amount of memory to represent a single item of data. All data of the same primitive type are the same size.
Non-Primitive Data Types: These data types are not actually defined by the programming language but are created by the programmer. They are also called “reference variables” or “object references” since they reference a memory location which stores the data.An object is a large chunk of memory that can potentially contain a great deal of data along with methods (little programs) to process that data.
what is an exception ? In Java “an event that occurs during the execution of a program that disrupts the normal flow of instructions .
The Java runtime system requires that a method must either catch or specify all checked exceptions that can be thrown by that method. This requirement has several components that need further description: “catch,” “specify,” “checked exceptions,” and “exceptions that can be thrown by that method.”
ex: while using scanner to read file in java :