Blog

Installing And Getting Started With Git

You need to install the version of Git for your system first before getting started. You can download Git for Windows from https://git-for-windows.github.io. A simple Google search will help you install Git.

This is the most important prerequisite for using git in your machine.

 

Tools

You can use various free GUI tools such as Tortoise Git or SourceTree for working with Git easily. 

We will see more about these later, if you face any doubt, please ask.

 

Essential Module-wise Exercises for Beginning Java Notes

This page contains a set of basic exercises that you need to complete along with your beginning Java notes. Exercises are divided into modules similar to the modules for multiple choice questions. Practice these alongside reading notes and answering the multiple choice questions.

 

JAVA BASICS

  1. Write a HelloWorld program. Write a simple program with a main method that prints Hello World.

Important Annotations for Spring Core Tasks

This is a quick summary of important annotations in Spring for doing core tasks in Spring. Some of them might have already been covered in examples. Some of them might be covered later. Some of them might be a variation of the already covered ones, so please feel free to try them out and let us know if you face any issues.

 

@Configuration, @Bean

You can use @Configuration to specify a Java configuration file. 

Important Questions and Observations in Spring Framework 4 Essentials

  1. If you invoke getBean("writer") and there are two beans defined with the name writer in your xml configuration file or Java configuration file. What will happen?
    • It will return the second one defined.

Autowiring in Spring

Through the autowiring feature, spring will intelligently guess some of the bean injection without needing to configure explicitly. Spring can do autowiring based on the type of the bean, name of the bean, and constructor of the bean. Default is autowire by type.

[Example] A Simple Spring Boot Application

A Spring Boot standalone application uses the @SpringBootApplication annotation over the main class, which also has the main method to execute the application. The SpringApplication.run method call accepts two parameters — the class that actually contains the annotated @SpringBootApplication annotation and any application arguments. The ApplicationArguments interface allows you to access any application arguments.

 

Spring Profiles Introduction

@Profile annotation allow you to register components that will be selected only if its associated profile is active. You can selectively activate a set of beans in a class or all beans .

Specifying base package in spring xml config file

Instead of using @ComponentScan annotation, we can also use <context:component-scan> element in an spring config xml.

spring.xml

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"

Format for Answering Multiple Choice Questions

Please follow the below guidelines for answering questions.

  1. Answer within the question bank itself, without changing the name.

  2. Color your answers with blue color. 

  3. Color your execution results in yellow color. Sometimes you might be asked to first answer without trying out and then actually try compiling/executing it. This step is not mandatory.

[Exercise] Find the middle element of linked list in one Pass

Problem:

Find the middle element of linked list in one Pass.

 

Approach:

You can use the runner technique.  

Two pointers can be used and both will be running at separate speeds. One runner pointer can go in two steps at a time and other pointer can go in one step at a time. Second one will always cover half the distance as that of the other. When one reaches the end, other will be be middle.

Pages

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!