Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Saturday, January 22, 2022

General Exception Handling Questions

General Exception Handling Questions

  1. What are the two types of Exceptions in Java? Which are the differences between them?
  2. What is the difference between Exception and Error in java?
  3. What is the difference between throw and throws?
  4. What is the importance of finally block in exception handling?
  5. What will happen to the Exception object after exception handling?
  6. How does finally block differ from finalize() method?

The above is Exception handing Questions, Now let us discuss all the questions one by one, which helps to increase your knowledge in Java.

What are the two types of Exceptions in Java? Which are the differences between them?

Java has two types of exceptions: checked exceptions and unchecked exceptions. Unchecked exceptions do not need to be declared in a method or a constructor’s throws clause if they can be thrown by the execution of the method or the constructor, and propagate outside the method or constructor boundary. On the other hand, checked exceptions must be declared in a method or a constructor’s throws clause. See here for tips on Java exception handling.

What is the difference between Exception and Error in java?

Exception and Error classes are both subclasses of the Throwable class. The Exception class is used for exceptional conditions that a user’s program should catch. The Error class defines exceptions that are not excepted to be caught by the user program.

What is the difference between throw and throws?

The throw keyword is used to explicitly raise a exception within the program. On the contrary, the throws clause is used to indicate those exceptions that are not handled by a method. Each method must explicitly specify which exceptions does not handle, so the callers of that method can guard against possible exceptions. Finally, multiple exceptions are separated by a comma

What is the importance of finally block in exception handling?

A finally block will always be executed, whether or not an exception is actually thrown. Even in the case where the catch statement is missing and an exception is thrown, the finally block will still be executed. The last thing to mention is that the finally block is used to release resources like I/O buffers, database connections, etc.

What will happen to the Exception object after exception handling?

The Exception object will be garbage collected in the next garbage collection.

How does finally block differ from finalize() method?

A finally block will be executed whether or not an exception is thrown and is used to release those resources held by the application. Finalize is a protected method of the Object class, which is called by the Java Virtual Machine (JVM) just before an object is garbage collected

Thursday, January 20, 2022

General Questions about Java

 General Questions about Java

  1. What is JVM? Why is Java called the Platform Independent Programming Language?
  2. What is the Difference between JDK and JRE?
  3. What does the “static” keyword mean? Can you override the private or static methods in Java?
  4. Can you access non-static variables in a static context?
  5. What are the Data Types supported by Java? What are Autoboxing and Unboxing?
  6. What is Function Overriding and Overloading in Java?
  7. What is a Constructor, Constructor Overloading in Java, and Copy-Constructor?
  8. Does Java support multiple inheritances?
  9. What is the difference between an Interface and an Abstract class?
  10. What is pass by reference and pass by values?
The above is General Questions about Java, Now let us discuss all the questions one by one, which helps to increase your knowledge in Java.

What is JVM? Why is Java called the Platform Independent Programming Language?

A Java virtual machine (JVM) is a process virtual machine that can execute Java bytecode. Each Java source file is compiled into a bytecode file, which is executed by the JVM. Java was designed to allow application programs to be built that could be run on any platform, without having to be rewritten or recompiled by the programmer for each separate platform. A Java virtual machine makes this possible because it is aware of the specific instruction lengths and other particularities of the underlying hardware platform.

What is the Difference between JDK and JRE?

The Java Runtime Environment (JRE) is basically the Java Virtual Machine (JVM) where your Java programs are being executed. It also includes browser plugins for applet execution. The Java Development Kit (JDK) is the full-featured Software Development Kit for Java, including the JRE, the compilers and tools (like JavaDoc, and Java Debugger), in order for a user to develop, compile and execute Java applications.

What does the “static” keyword mean? Can you override the private or static methods in Java?

The static keyword denotes that a member variable or method can be accessed, without requiring an instantiation of the class to which it belongs. A user cannot override static methods in Java, because method overriding is based upon dynamic binding at runtime and static methods are statically binded at compile time. A static method is not associated with any instance of a class so the concept is not applicable.

Can you access non-static variables in a static context?

A static variable in Java belongs to its class and its value remains the same for all its instances. A static variable is initialized when the class is loaded by the JVM. If your code tries to access a non-static variable, without any instance, the compiler will complain, because those variables are not created yet and they are not associated with any instance.

What are the Data Types supported by Java? What are Autoboxing and Unboxing?

The eight primitive data types supported by the Java programming language are:

• byte

• short

• int

• long

• float

• double

• boolean

• char

Autoboxing is the automatic conversion made by the Java compiler between the primitive types and their corresponding object wrapper classes. For example, the compiler converts an int to an Integer, a double to a Double, and so on. If the conversion goes the other way, this operation is called unboxing.

What is Function Overriding and Overloading in Java?

Method overloading in Java occurs when two or more methods in the same class have the exact same name, but different parameters. On the other hand, method overriding is defined as the case when a child class redefines the same method as a parent class. Overridden methods must have the same name, argument list, and return type. The overriding method may not limit the access of the method it overrides.

What is a Constructor, Constructor Overloading in Java, and Copy-Constructor?

A constructor gets invoked when a new object is created. Every class has a constructor. In case the programmer does not provide a constructor for a class, the Java compiler (Javac) creates a default constructor for that class. The constructor overloading is similar to method overloading in Java. Different constructors can be created for a single class. Each constructor must have its own unique parameter list. Finally, Java does support copy constructors like C++, but the difference lies in the fact that Java doesn’t create a default copy constructor if you don’t write your own.

Does Java support multiple inheritances?

No, Java does not support multiple inheritance. Each class is able to extend only on one class but is able to implement more than one interface.

What is the difference between an Interface and an Abstract class?

Java provides and supports the creation both of abstract classes and interfaces. Both implementations share some common characteristics, but they differ in the following features:

• All methods in an interface are implicitly abstract. On the other hand, an abstract class may contain both abstract and nonabstract methods.

• A class may implement a number of Interfaces, but can extend only one abstract class.

• In order for a class to implement an interface, it must implement all its declared methods. However, a class may not implement

all declared methods of an abstract class. Though, in this case, the subclass must also be declared as abstract.

• Abstract classes can implement interfaces without even providing the implementation of interface methods.

• Variables declared in a Java interface is by default final. An abstract class may contain non-final variables.

• Members of a Java interface are public by default. A member of an abstract class can either be private, protected, or public.

• An interface is absolutely abstract and cannot be instantiated. An abstract class also cannot be instantiated but can be invoked if it contains the main method.

What is pass by reference and pass by values?

When an object is passed by value, this means that a copy of the object is passed. Thus, even if changes are made to that object, it doesn’t affect the original value. When an object is passed by reference, this means that the actual object is not passed, rather a reference of the object is passed. Thus, any changes made by the external method, are also reflected in all places.


Tuesday, January 18, 2022

Syllabus for Java Developer

Syllabus for Java Developer

IT professionals, fresh professionals, and Engineering students from all Computer science/Information Technology professional degrees can learn complete Java programming language based on the industry syllabus.

 Professionals from the IT industry who are currently working in other programming languages and want to switch over Java technologies can use this syllabus to enhance their knowledge of java.

Step 1

● Basics of Java:

Ø    If-else, For/while loop, Function, Array, Input/output

● Java OOPs Concepts:

Ø    Object, Class, Inheritance, Polymorphism, Abstraction, Encapsulation

Step 2 

● Exception Handling in Java

● String, StringBuffer & StringBuilder

● Regular Expression

● Java Collection:

Ø  ArrayList, LinkedList, HashSet, TreeSet, HashMap, TreeMap, Hashtable 

Step 3

Streams and File Handling in Java 

● Threads in Java: 

Ø Multithreading related concepts, problems & their solutions 

● Java Swing 

Step 4

● Socket Programming in Java 

● More on Object-Oriented Design related concepts (with the help of some real-life examples) 

● Minor Project 1: 

Ø Group Chatting Application using Socket Programming and o Swing (for UI) in Java 

Step 5

● Introduction to MySql 

● JDBC (Java Database Connectivity) 

● Minor Project 2: 

Ø Library Management System using Java Swing (for UI), JDBC, and MySQL 

Step 6

● Introduction to Web Services 

● Introduction to Spring Framework 

Step 7 

● Introduction to Spring Boot 

● RESTful Web Services with Spring and Spring Boot 

● Minor Project 3: 

Ø Developing a microservice using Spring Boot 

Step 8 

● Data Access Using JDBC Template 

● Introduction to JPA 

● Spring JPA 

Step 9

● Spring Security 

● Spring Caching 

● Spring Retry 

Step 10

 ● Spring Aspect-Oriented Programming 

● Spring Kafka 

● Spring Actuator 

Step 11

 Major Project 

● Developing a personal finance management system 

Step 12 

Major Project 

● Developing a personal finance management system

 

Monday, January 17, 2022

Why Use Any Framework?

Why Use Any Framework?


let's first understand why do we need to use any framework at all in the first place

Framework platforms are extremely dynamic, reusable, and feature helpful tools that allow developers to work more efficiently. Think of them as a template for computer programming. Each framework is based around a specific coding language, such as Java, Python, C+, CSS, or PHP, and creates a blueprint for developing in that style. 

Frameworks can be used for both front-end and back-end development, in standalone applications, and in web development. While each type of software framework platform has its own unique features, they also share some common benefits.

A general-purpose programming language like Java is capable of supporting a wide variety of applications. Not to mention that Java is actively being worked upon and improving every day.

Moreover, there are countless open source and proprietary libraries to support Java in this regard. So why do we need a framework after all? Honestly, it isn't absolutely necessary to use a framework to accomplish a task. But, it's often advisable to use one for several reasons:

  • Helps us focus on the core task rather than the boilerplate associated with it
  • Brings together years of wisdom in the form of design patterns
  • Helps us adhere to the industry and regulatory standards
  • Brings down the total cost of ownership for the application

We've just scratched the surface here and we must say that the benefits are difficult to ignore. But it can't be all positives, so what's the catch:

  • Forces us to write an application in a specific manner
  • Binds to a specific version of language and libraries
  • Adds to the resource footprint of the application

What Is the Difference Between a Framework and a Library?

Sometimes the terms “framework” and “library” are used interchangeably. Why would any developer choose to work with one or another? While both have bundled, prepackaged code, a programmer has good reason to choose one over the other depending on the type of project they’re developing.

When using a code library, the programmer is “calling” the code, meaning they have full control and responsibility over where the code goes and how it all works together. 

In a framework environment, the programmer is told where to plug in code by the framework application itself. This is a concept known as inversion of control, and it helps to reduce bugs, make testing easier, reduce server usage, and provide an overall more dynamic programming experience.

One way to look at it is by exploring this bike/car-buying analogy: When a developer is using a code library, it’s a lot like purchasing a mechanic’s manual, toolkit, and set of auto parts in order to build a bike/car. While you might have the necessary instructions and components, the final product is 100% your responsibility. 

Using frameworks is more like buying a bike from a dealer, where you can select a model and then decide on things like color, accessories, and safety features. While the terms library and framework are used interchangeably, choosing to work with a framework simply requires much less labor and reduces the risks of breakdowns.

What Are the Different Types of Frameworks?

Programmers can choose from a number of software frameworks to suit the functionality needed for a wide range of projects. Frameworks are typically built from popular programming languages.

Some of the most common and popular frameworks used today include the following.

Web Application Development Frameworks 

  • JavaScript frameworks (JS frameworks) make it easier to build applications for both iOS and Microsoft.
  • Popular frameworks include AngularJS, Ruby on Rails, and Laravel.

DataScience Frameworks

  • Java, Scala, Python, R, and SQL frameworks simplify large-scale data processing from researching and prototyping, through to production deployment.
  • Linear models for data analysis can predict behavior, language modeling, and image recognition and processing. Natural language processing (NLP) and machine learning (ML) are flexible and pre-designed to speed builds and increase a programmer’s ability to deploy ML-powered applications.
  • Popular frameworks include Apache Spark, PyTorch, and TensorFlow.

Mobile Application Development Frameworks

  • Free, open-source mobile user interface toolkits make it possible for developers to ensure consistency across cross-platform applications for Android, iOS, and all web interfaces.
  • These frameworks can also be used to simplify the development of applications for mobile, web, and desktop from a single codebase.
  • .NET and C# improve building for Android and iOS applications.
  • Popular frameworks include Ionic, Xamarin, and Flutter.



Thursday, July 15, 2021

One Language, One Platform: A Lifetime of Opportunity

 

One Language, One Platform: A Lifetime of Opportunity

Knowing Java will be a clear advantage in your future career. When you learn Java, you’re learning more than just a language. Because Java is a technology platform with many interconnected capabilities that can give cutting-edge, in-demand job skills. In fact, Java tops Inc.com’s list of the ten most popular programming languages. Java can take you where you want to go.

Java


Hello reader,  When you learn Java, you're learning more than just a language, Because java is a technology platform with many interconnected capabilities that can give cutting-edge, in-demand job skills. Java can take you where you want to go......
In my blog, I am also sharing my experience in Java, Java is a simple yet efficient and powerful language. Hence, its effectiveness thrives throughout the developer world even today. We can code various types of effective programs using Java. As we dive deeper into the plethora of features of Java, you will realize why it’s still one of the most used programming languages till date.


Saturday, April 3, 2021

Basic (Experience In JAVA)

Hello Reader, now I am sharing my experience in the JAVA language, the last 2year I have to learn java and develop many java programs and java project in small scale, I know its just start for learning but now a day have able to develop large scale project and currently, I have to develop a large scale project.(sorry for I don't have to share any details about my project for the security reason). 

INTRODUCTION TO COMPUTER NETWORKS

A Computer network consists of two or more autonomous computers that are linked (connected) together in order to: • Share resources (files...