Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Programming Articles - Page 2576 of 3366
4K+ Views
In this article, we will learn about useful and important functions in PHP for file inclusion. All these functions require, require_once, include and include_once are utilized to include the files in the php page but there is a slight distinction among them in terms of functionality.Let's discuss these functions below with their functionality.include() :This function is used to include a file in a PHP page. If include() function is not able to find a specified file on location at that time it will throw a warning message however, it will not stop script execution.require():This function is utilized to add a ... Read More
10K+ Views
Title Case a sentence in javascriptIt is nothing but converting first element of all the words in a sentence in to uppercase while the other elements remain in lowercase. The provided string(sentence) may contains a bunch of lowercase and uppercase elements. So we need an algorithm to Title Case the provided string.AlgorithmDivide all the words in the sentence individually. This task can be achieved by using string.split() method.Convert all the elements in each and every word in to lowercase using string.toLowerCase() method. Loop through first elements of all the words using for loop and convert them in to uppercase. After converting, ... Read More
17K+ Views
Declaring Multiple Classes in Java Program A single Java program may contain two or more classes, it is possible in two ways: Multiple non-nested classes Nested classes The Multiple non-nested Classes We can create as many classes as we want in a single Java program but writing many classes in a single file is not recommended as it makes code difficult to read rather we can create a single file for every class. When we compile a Java program with two or more classes (non-nested), the same number of .class ... Read More
4K+ Views
Method overriding works because of the run-time method binding feature in Java. So, if we force the Java compiler to do static binding for a method then we can prevent that method from being overridden in a derived class. Preventing Method Overriding in Java We can prevent method overriding in Java in 3 ways: By declaring a method as "final" in the base class By declaring a method as "static" in the base class By declaring a method as "private" in the base class Final Methods cannot be Overridden ... Read More
839 Views
Palindrome is a string that even when reversed will be the same as the original string. In simple words, the palindrome string will have odd length and the element in 0th index and the last index will be the same, element in 1st index will be the same as the second last element and so on. The palindrome contains alphanumeric elements; that means it contains the alphabet(a-z) and digits (0-9) as well. A palindrome string must look like − var str = "121Malayalam121"; Let’s understand with a suitable example. Let’s understand with a suitable example. Example 1 In the ... Read More
3K+ Views
To append text to JTextArea, use the component’s append() method. Let’sa say the following is our text in the JTextArea -JTextArea textArea = new JTextArea("The text added here is just for demo. "+ "This demonstrates the usage of JTextArea in Java. ");Now, append text to the same textArea -textArea.append("In this example we have deleted some text from the beginning."+ "We have also appended some text.");The following is an example to append text to JTextArea -Examplepackage my; import java.awt.GridLayout; import javax.swing.*; public class SwingDemo { SwingDemo() { JFrame frame = new JFrame("Demo"); JTextArea textArea ... Read More
1K+ Views
PHP5 added the object-oriented programming approach with the previous version, which is used for making code reusable in real time php application.Some of the concepts of object-oriented models are: class, object, encapsulation, polymorphism, abstract and final classes, and methods, interfaces and inheritance, etc...Here we discuss the basic differences between abstraction and encapsulation.Encapsulation:Encapsulation is an approach that joins data members(variables) and implementation details into a single unit called the class that implies class is formed with variables and methods present inside it.Encapsulation is a protection mechanism for data members present inside the class i.e data members are not accessible by end ... Read More
183 Views
Flattening an arrayFlattening an array is nothing but merging a group of nested arrays present inside a provided array. Flattening of an array can be done in two ways. 1) concat.apply() In the following example there are some nested arrays containing elements 3, 4, 5 and 6. After flattening them using concat() method we get the output as 1, 2, 3, 4, 5, 6, 9. Example Live Demo var arrays = [1, 2, [3, 4, [5, 6]], 9]; var merged = [].concat.apply([], arrays); documemt.write(merged); Output1, 2, 3, 4, 5, 6, 92) array.flat()In ... Read More
4K+ Views
The Java team and developer community suggest us to follow naming conventions. They are just conventions and are not mandatory but help in writing Java programs that are more understandable and easier to read. For example, class names should generally be nouns, and interface names should be adjectives. Additionally, capitalize the first letter of each separate word. The names used for classes, variables, and methods are called identifiers. Need to Follow Java Naming Conventions Following are the reasons to follow naming conventions: Multiple developers work on the same project simultaneously. Names that follow naming standards reduce ... Read More
15K+ Views
The default and parameterized constructors are two types of Constructor in Java. The constructor is a special member of a Java class whose name is the same as the class name. It is used to assign values to a class variable at the time of object creation. In this article, we are going to discuss the difference between default and parameterized constructors. Default Constructor When we do not add a constructor to a Java class. The compiler adds a default constructor implicitly. It accepts 0 arguments. If we do not initialize the instance variables of a class, a default constructor will ... Read More