java function

Write a java function that accepts an integer array and returns 1 if it is a centered array, otherwise it returns 0.

An array with an odd number of elements is said to be centered if all elements (except the middle one) are strictly greater than the value of the middle element. Note that only arrays with an odd number of elements have a middle element. Write…

Using Node.js File System Module

Node.js File System Module helps you to work with files on your computer or server.You can read, edit, write, create or rename files. To use file system you need to import them i.e var fs=require(‘fs’) Reading Files To read files on your computer we use…


  Using Node.js Http Module

As I mentioned earlier in Node.js Modules tutorial,Node.js has built in modules and Http module is one of them. This module is used to transfer data over hyper text transfer protocol(http). To use http module we need to include it in our script  using require…

node date function

Creating Node.js Modules

Modules are javascript libraries that can be used in developing an application.They are set of functions. Types of Modules 1.Built in modules-these are node.js modules that can be used without installing them.Example of these modules are:- http-makes node.js act like http server. https-makes node.js act…

Node.js hello world example

Getting Started with Node.js tutorial

Node.js is a Javascript framework that allows you to run javascript on server. Learning by examples. First of all make sure you have downloaded and installed node.js before getting started with this tutorial. Hello word node.js application. Code

How to  run above code First…

How to override Java Methods

Overriding java methods happen in a case where a child class implements a method that is contained in super class.The main use of overriding is to provide a new implementation of a method. Overriding Java methods can take place if only:- Child class and parent…

How to overload java methods by changing data type

How to overload java methods by changing data type

Below code shows how to overload java method by changing data type.See also Overloading java methods by changing the number of arguments.  


How to overload java methods by changing number of arguments

How to overload java methods by changing number of arguments

The main reason why programmers overload methods are for easier readability.Think of a scenario where you have a method to multiply two numbers and another method multiply three numbers.These methods will have different names.Instead of using different names, java overloading allows us to use the…

What is Aggregation in Java

Aggregation in Java is very important because it makes code reusable.Think of a scenario where you’re creating a school-based management system.Student name, id, age are mandatory to be a caption in the system.Think of a student address.Student address will contain student state, city, zipcode etc.…

Multilevel Inheritance in Java Example

In my previous post about Single level inheritance  I exampled how a child class can inherit methods from the parent class.Below code demonstrates, a more complex inheritance called Multilevel.