Thursday, February 27, 2020

what is pointer

Pointer in c language is a variable that stores the address of other variable at run time (dynamically). It can be of any primitive data type or user defined data type. Pointer enables us to access a variable that might be defined outside the function. 

Why doesn't Java have pointers?

First we need to discuss about pointer before going further.

Pointer in c language is a variable that stores the address of other variable at run time (dynamically). It can be of any primitive data type or user defined data type. Pointer enables us to access a variable that might be defined outside the function. 

Java has pointers everywhere but terminology is different. In java, objects created are referred/pointed by reference variable. Except primitive data type, everything in java is instance or object which can be used via reference variable which is similar to pointer in c/c++. 
But there is no 'address of' (&) operator to get the address of the object as we can in c/c++.

So, 
1. we can't use pointer arithmetic like things in java. 
2. We can't use get the address of an object.
3. We can't move from one node to another by incrementing the pointer, as we can in c/c++
4. We can use pointer for an array and traverse the whole array via pointer increment or decrement.

Saturday, January 11, 2020

Send or Receive Email using java

It is necessary to activate your gmail account to be accessed from less secure app. For this purpose You should have to be login to your gmail account which you want to for sending/receiving email using java and then just visit following link whose screenshot is given below.
Now you have to click the toggle button to ON the allow less secure apps.
It will allow your java program to access your gmail.
If you need video instruction regarding program just follow these two videos:

How to fetch email from Gmail using javamail API



How to send email from your gmail using Java