JAVA Lecture 2

JAVA Lecture 2

Features Of JAVA

  1. Simple Language (concepts remain the same throughout )
  2. It is object-oriented (related to real-world objects)
  3. Java .jar files are portable
  4. Java is platform independent
  5. Java is secure
  6. There is a clear separation between Java and OS
  7. It is robust
  8. Java has high performance as it is both complied and interpreted both
  9. Java has just in time compiler which increases its speed
  10. Java has multiple threads
  11. Java has a huge community of help
  12. Java is statically typed language

class vs objects

  1. Class is like the blueprint for the object
  2. Object is the actual realization of the object, also called an instance of the class
  3. Every object has two things a.property or variables b. action or function can also be called a method they are created at run time
  4. When we want to create an object we need to have a class
  5. To call the method defined inside a class we compulsorily need to have an object
  6. JVM will always need an entry point which is the main method
  7. public keyword indicates that the method is accessible outside
  8. Static indicates that does not create an object but directly calls the method inside

hence we have a public static void main

Naming Convention in Java

  1. Classes are named with starting capital letter
  2. variables and methods should be starting small letter
  3. For combined word use camel casing which means the second word is capital

Typecasting In Java

  1. Implicit type casting happens when we are widening smaller to a bigger range
  2. Explicit type casting happen when we are going from bigger to smaller or narrowing

Type Promotion in Java.jpg