- Trending Categories
- 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
Found 34494 Articles for Programming
537 Views
A class in Java is a user-defined datatype, a blueprint, a classification, that describes the behavior/state that the object of its type support. Example public class Dog { String breed; int age; String color; void barking() { } void hungry() { } void sleeping() { } } A class can contain any of the following variable types. Local variables − Variables defined inside methods, constructors or blocks are called local ... Read More
6K+ Views
You can contents of a blob into a byte array using the getBytes() method.Exampleimport java.awt.Image; import java.awt.image.BufferedImage; import java.sql.Blob; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import java.util.Arrays; public class BlobToByteArray { public static void main(String[] args) throws Exception { Image image = new BufferedImage(300, 400, BufferedImage.TYPE_INT_RGB); String JDBC_DRIVER = "com.mysql.jdbc.Driver"; String DB_URL = "jdbc:mysql://localhost/mydb"; String USER = "root"; String PASS = "password"; ... Read More
2K+ Views
A two-dimensional array is nothing but an array of one dimensional arrays. Therefore to map a two dimensional array into one dimensional arrays.Create arrays equal to the length of the 2d array and, using for loop store the contents of the 2d array row by row in the arrays created above.Examplepublic class Mapping_2DTo1D { public static void main(String args[]) { int [][] array2D = {{7, 9, 8, 5}, {4, 5, 1, 8}, {9, 3, 2, 7}, {8, 1, 0, 9}}; int [] myArray1 = new int[array2D[0].length]; int [] myArray2 = ... Read More
10K+ Views
A directory is simply defined as a collection of subdirectories and single files; or either one of them. A directory hierarchy is constructed by organizing all the files and subdirectories within a main directory, also known as “root” directory. These subdirectories are separated using a “/” operator in a directory hierarchy. Since the directory is organized in the form of a hierarchy/tree, scanning it can be likened to traversing a tree. And to do that, there are various ways. Using os.walk() method Using glob.glob() method Using os.listdir() method The directories are handled by the operating system; therefore, whenever ... Read More
3K+ Views
As a Python coder, you may often come across scenarios where you need to access the user's home directory to perform specific operations like reading or writing user−specific files, configuration files, or data. However, the location of the home directory can change across different operating systems, making it a challenge to access it in a platform−independent manner. In this extensive article, we will explore various methods to obtain the home directory in Python effectively and efficiently. We will proceed to provide step−by−step explanations and code examples to understand the process. Whether you're developing a cross−platform application or simply need to ... Read More
6K+ Views
Directory creation is a common task for computer users. You might need to create a directory to store some files, or to place some new files inside an existing directory. In this article, you will learn how to find if a directory already exists in Python or not. A directory is a file system structure used by operating systems and software applications to organize files. It can also refer to a list of files and folders, like the current folder in Windows Explorer. Sometimes there arises a need to check whether a certain directory exists in a system or not; ... Read More
1K+ Views
In the domain of Python programming, organization and modularity are pivotal in crafting efficient and maintainable code. As your Python projects grow in complexity, the necessity to disseminate common data across multiple files becomes paramount. Gratefully, Python furnishes several techniques to accomplish this seamlessly. Within this article, we shall embark on a journey of a few distinct methods to share common data among multiple Python files. Each approach boasts its unique strengths and adaptability, endowing you with the ability to construct scalable and robust Python projects. You will be guided through each method with comprehensive explanations in a human-friendly style. ... Read More
8K+ Views
When you venture into the realm of file processing, the need to discern disparities and differences between two files arises frequently. Python equips us with an array of potent tools to accomplish this task with ease and precision. In this article, we shall navigate a few distinct methodologies to reveal the differences between two files in Python. Each approach is equipped with unique functionalities and adaptability, granting you the ability to seamlessly compare files of varying sizes and formats. As a Python coding enthusiast, you are walked through each method, providing stepwise explanations in a style that is human-friendly. By ... Read More
392 Views
Yes, you can −int [] myArray1 = {23, 45, 78, 90, 10}; int [] myArray2 = {23, 45, myArray1[2], 90, 10};But, once you do so the second array stores the reference of the value, not the reference of the whole array. For this reason, any updating in the array will not affect the referred value −ExampleLive Demoimport java.util.Arrays; public class RefferencingAnotherArray { public static void main(String args[]) { int [] myArray1 = {23, 45, 78, 90, 10}; int [] myArray2 = {23, 45, myArray1[2], 90, 10}; System.out.println("Contents of the ... Read More