Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
What is method hiding in Java and how to use it?
When super class and sub class contains same method including parameters and if they are static. The method in the super class will be hidden by the one that is in the sub class. This mechanism is known as method hiding. Example class Demo{ public static void demoMethod() { System.out.println("method of super class"); } } public class Sample extends Demo { public static void demoMethod() { System.out.println("method of sub class"); } public static void main(String args[] ) { Sample.demoMethod(); } } Output method of sub class
Read MoreHow to match a line not containing a word in Java Regex
Exampleimport java.util.regex.Matcher; import java.util.regex.Pattern; public class NoRegTest { public static void main(String[] args) { String s="^fun"; Pattern pattern = Pattern.compile(s); Matcher matcher = pattern.matcher("Java is fun"); if(!matcher.find()) { System.out.println("not found"); } } }Outputnot found
Read MoreSet Column Ordering in Bootstrap
Write the columns in an order, and show them in another one. You can easily change the order of built-in grid columns with .col-md-push-* and .col-md-pull-*modifier classes where * range from 1 to 11.Example Bootstrap Example Heading Before Ordering I am on left I am on right After Ordering I was on left I was on right
Read MoreHow do I write variable names in Java?
While choosing an identifier to declare a variable in Java you need to keep the following points in mind. The name of the variable should begin with either alphabet or, an underscore (_) or, a dollar ($) sign. The identifiers used for variables must not be keywords. No spaces or special characters are allowed in the variable names of Java. Variable names may contain 0 to 9 numbers (if not at the beginning). Variable names are case sensitive i.e. MY_NUM is different from my_num. If you use two words in a identifier then the you should follow camel case ...
Read MoreWhy is method overloading not possible by changing the return type of the method only in java?
Overloading is the mechanism of binding the method call with the method body dynamically based on the parameters passed to the method call. If you observe the following example, it contains two methods with same name, different parameters and if you call the method by passing two integer values the first method will be executed and, if you call by passing 3 integer values then the second method will be executed.It is not possible to decide to execute which method based on the return type, therefore, overloading is not possible just by changing the return type of the method. Example ...
Read MoreRuntime Polymorphism in Java
Method overriding is an example of runtime polymorphism. In method overriding, a subclass overrides a method with the same signature as that of in its superclass. During compile time, the check is made on the reference type. However, in the runtime, JVM figures out the object type and would run the method that belongs to that particular object.ExampleSee the example below to understand the concept −class Animal { public void move() { System.out.println("Animals can move"); } } class Dog extends Animal { public void move() { System.out.println("Dogs can walk and run"); ...
Read MoreMake an image responsive with Bootstrap
To make an image responsive in Bootstrap, add a class .img-responsive to the tag. This class applies max-width: 100%; and height: auto; to the image so that it scales nicely to the parent element.The following is how you can simply make an image responsive −Example Bootstrap Example
Read MoreCan we overload the main method in Java?
Yes, we can overload the main method in Java, but When we execute the class JVM starts execution with public static void main(String[] args) method. Example public class Sample{ public static void main(){ System.out.println("This is the overloaded main method"); } public static void main(String args[]){ Sample obj = new Sample(); obj.main(); } } Output This is the overloaded main method
Read MoreBootstrap lead class
The lead class in Bootstrap is used to add emphasis to a paragraph.You can try to run the following code to implement the lead class in Bootstrap −Example Bootstrap lead class Lead Example This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is an example paragraph demonstrating the use of lead body copy.
Read MoreBootstrap class to emphasize text
HTML's default emphasis tags such as sets text at 85% the size of the parent, emphasizes a text with heavier font-weight, and emphasizes a text in italics.You can try to run the following code to an emphasis on text −Example Bootstrap emphasis tags This content is within tag This content is within tag This content is within tag and is rendered as italics Left aligned text. Center aligned text. Right aligned text. This content is muted This content carries a primary class This content carries a danger class
Read More