There is a various way, you can pass parameter from a console . Using BufferdReader,InputStream but the easiest way to do it with Scanner class it took Inputstream(System.in) as parameter from we can get user given value
Let see an example
package...
Home » Archives for March 2016
Spring framework download and integration with eclipse step by step.
in
download spring framework jars for eclipse spring installation,
spring,
spring eclipse tutorial,
spring framework download,
spring framework eclipse,
spring framework in java,
Spring tutorial
- on March 10, 2016
- No comments
In this tutorial we will learn how we can download spring framework jars for eclipse and integrate the downloaded spring framework with eclipse . Then we create a basic Spring example to check our setup is successful or not.
Here...
multiple inheritance in java?
in
how to achieve multiple inheritance in java,
java,
multiple inheritance in java,
multiple inheritance in java example,
multiple inheritance in java using interface
- on March 08, 2016
- No comments
Java directly does not support multiple inheritance , but by interface it supports the same.
To understand why java does not support multiple inheritance first we need to understand the Diamond problem
Diamond problem says
Suppose we...
Does Java support multiple inheritance?
in
java,
java interview
- on March 08, 2016
- No comments
Java directly does not support multiple inheritance , but by interface it supports the same.
To understand why java does not support multiple inheritance first we need to understand the Diamond problem
Diamond problem says
Suppose we...
Does runtime polymorphism can be acheived by data memebrs?
in
java,
java interview
- on March 08, 2016
- No comments
No Overriding can not be performed on properties/data members it always call the reference class properties value
Let take an example
Public class Father
{
public int age=60;
}
Public class Child extends Father
{
public ...
How does Map work in Java?
in
Hashmap,
java,
java interview,
map
- on March 08, 2016
- No comments
HashMap in Java works on hashing principle. The Map is a data structure which allows us to store object with a key and retrieve same by the same key. Hash functions are used to link key and value in HashMap. Objects are stored by calling put(key, value)...
what is servlet collaboration?
in
j2ee,
java interview
- on March 08, 2016
- No comments
Servlet Collaboration means how one servlet can communicate with other. Sometimes servlets are to pass the common information that is to be shared directly by one servlet to another through various invocations of the methods. To perform these operations,...
Can we Overload Main method in java.
in
can we overload main method,
java,
java 5,
java 6,
java interview,
main method,
overload main,
overloading
- on March 04, 2016
- No comments
Yes you can overload main method but public static void main(String[] args) is entry point in java. JVM always search for this method.
If it is not present in overloaded version ,when you try to run your code that gives run time exception no main method...
Display trangle in screen using Java.
in
java,
java interview
- on March 04, 2016
- No comments
package com.example.loop.star;
/*
*
* This class display triangle as follows
*
* *
* * *
* ...
Is Spring Bean Thread Safe?
in
spring
- on March 04, 2016
- No comments
Thread safety is a different context . Singleton spring beans has no relation with thread safety. spring container only manages life-cycle of objects and guaranteed that only one object in spring container. so If an Non thread safe object is injected...
How do you handle error condition while writing stored procedure or accessing stored procedure from java?
in
java,
java interview
- on March 04, 2016
- No comments
When you call a store procedure the store procedure will execute in database server so if there any exception occurs that can be handled in EXCEPTION block in the store proc. If the store procedure it self fails it throws sql exception which can be...
What is JCS?
in
java,
java interview,
JCS
- on March 04, 2016
- No comments
JCS stands for Java Caching System. This is an open source project and released by Apache written in Java. Like all other caching system JCS has following features.
1. JCS supports In memory cache.
2. Provide method for add objects in Cache.
3....
How to get client machine name and Ip address from Httpservlet?
in
j2ee,
java interview
- on March 04, 2016
- No comments
In HttpServletRequest there are two methods
a. getRemoteAddr()
b. getRemoteHost()
which will provide the necessary information.
Actually in request header following information is stored.
Ip address of client m/c = request.getRemoteAddr();
Hostname...
What is difference between include action and include directive in JSP?
in
j2ee,
java interview
- on March 04, 2016
- No comments
Before starting the difference discussion, first, we have to understand the JSP life cycle. when a request first comes to a JSP it will translate into servlet then compile and load into web container for further use. Subsequent requests ...
Benifits of Static methods
in
java,
java interview
- on March 04, 2016
- No comments
Static keywords mean, methods/variables attached to class, not with objects. So this variables/methods is shared with all objects instances of this class.Following advantages, we can get using static.
1. We can invoke a static method without...
Can we have main method tn abstract class?
in
java,
java interview
- on March 04, 2016
- No comments
Yes, you can use the main method in abstract class. The main method is a static method so it is associated with Class, not with object/ instance. The abstract is applicable to the object so there is no problem if it contains the main method. In main...
Can we Instantiate Abstract Class?
in
java,
java interview
- on March 04, 2016
- No comments
The main reason is abstract class may have abstract methods . An abstract method is like template/contract, according to inheritance rule every concrete subclass must have to provide a concrete definition of the same. So we can say...
Can we make constuctor as final
in
java,
java constructor,
java final constructor,
java interview
- on March 04, 2016
- No comments
No Constructor can never be Final. Only private,public and protected modifiers can use with the constructor.
We use final in method level because we don't want subclass inherits that method and overwrite it . But constructor is not a method...