- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Syed Javed has Published 26 Articles
Syed Javed
128 Views
The Array object lets you store multiple values in a single variable. It stores a fixed-size sequential collection of elements of the same type.Here is a list of some of the methods of the Array object:S.NoMethod & Description 1concat()Returns a new array comprised of this array joined with ... Read More
Syed Javed
1K+ Views
Local variables are declared in methods, constructors, or blocks.Local variables are created when the method, constructor or block is entered and the variable will be destroyed once it exits the method, constructor, or block.Access modifiers cannot be used for local variables.Local variables are visible only within the declared method, constructor, ... Read More
Syed Javed
99 Views
Yes, a variable can be downcast to its lower range substitute by casting. It may lead to data loss although. See the example below −ExampleLive Demopublic class Tester { public static void main(String[] args) { int a = 300; byte b = (byte)a; System.out.println(b); } }OutputIt will print output as −44
Syed Javed
236 Views
JDK 1.5 introduced a new for loop known as foreach loop or enhanced for loop, which enables you to traverse the complete array sequentially without using an index variable.ExampleLive Demopublic class ArrayUsingForEach { public static void main(String[] args) { double[] myList = {1.9, 2.9, 3.4, 3.5}; for (double element: myList) { System.out.println(element); } } }Output1.9 2.9 3.4 3.5
Syed Javed
6K+ Views
Consider a class Tester which has implemented Cloneable interface. Now you can initialize an object using following three ways −1. Using new keyword.Tester tester1 = new Tester();2. Using Class.forName() methodTester tester4 = (Tester)Class.forName("Tester").newInstance();3. Using clone method.Tester tester2 = tester1.clone();
Syed Javed
310 Views
Following the the best practices while declaring a variable. These best practices maintains code readability, understandability as project code size increases.Variables names should be short or long enough as per the scope. For example, loop counter variable, i is fine whereas employee as loop variable.Specific words should not be used ... Read More
Syed Javed
904 Views
The InputStream class in Java provides read() method. This method accepts a byte array and it reads the contents of the input stream to the given byte array.ExampleLive Demoimport java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; public class StreamToByteArray { public static void main(String args[]) throws IOException{ ... Read More
Syed Javed
561 Views
Following is the required program.ExampleLive Demopublic class Tester { public static void main(String args[]) { //matrix 1 int a[][] = { { 1, 3, 4 }, { 2, 4, 3 }, { 3, 4, 5 } }; //matrix 2 ... Read More
Syed Javed
908 Views
There are multiple ways to write a C++ program without semicolons. Note that doing this is very bad practice and should never be used in real code. This is presented just as informational content. The easiest way to write a C++ Program without Semicolons is using if statements. Almost all ... Read More
To Continue Learning Please Login
Login with Google