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 3285 of 3366
437 Views
The java.lang.Thread class is a thread of execution in a program. The Java Virtual Machine allows an application to have multiple threads of execution running concurrently. Following are the important points about Thread −Every thread has a priority. Threads with higher priority are executed in preference to threads with lower priority.Each thread may or may not also be marked as a daemon.There are two ways to create a new thread of execution.One is to declare a class to be a subclass of Thread.Another way to create a thread is to declare a class that implements the Runnable interface. Read More
330 Views
A multi-threaded program contains two or more parts that can run concurrently and each part can handle a different task at the same time making optimal use of the available resources specially when your computer has multiple CPUs.Multi-threading enables you to write in a way where multiple activities can proceed concurrently in the same program.Exampleclass RunnableDemo implements Runnable { private Thread t; private String threadName; RunnableDemo( String name) { threadName = name; System.out.println("Creating " + threadName); } public void run() { ... Read More
547 Views
The ability to run multiple programs or parts of programs (threads) in parallel is known as concurrency.A multi-threaded program contains two or more parts that can run concurrently and each part can handle a different task at the same time making optimal use of the available resources especially when your computer has multiple CPUs. Multi-threading enables you to write in a way where multiple activities can proceed concurrently in the same program.
2K+ Views
A thread goes through various stages in its lifecycle. For example, a thread is born, started, runs, and then dies. New − A new thread begins its life cycle in the new state. It remains in this state until the program starts the thread. It is also referred to as a born thread. Runnable − After a newly born thread is started, the thread becomes runnable. A thread in this state is considered to be executing its task. Waiting − Sometimes, a thread transitions to the waiting state while the thread waits for another thread to perform a task. ... Read More
567 Views
A tuple is a collection of python objects that are separated by commas which are ordered and immutable. Tuples are sequences, just like lists. The differences between tuples and lists are, that tuples cannot be changed unlike lists and tuples use parentheses, whereas lists use square brackets. Let us see about the creation of tuples in a detailed way. We can define tuple in different ways as follows - Empty Tuple ... Read More
3K+ Views
Sometimes it is necessary to divide a lengthy list into smaller and easy-to-read data. For example- if you wish to arrange a list of items in groups, it can be helpful to break it into small parts. This is useful for tasks like grouping data for analysis or showing items in a user interface. Python provides various simple methods to do this. In order to work with smaller data sets without losing any information, this article will show you how to split a list into uniformly sized chunks. What is List? List is one of the frequently used data ... Read More
6K+ Views
As you may know a string is a group of letters, numbers, or symbols in Python. Sometimes we do not need the whole string. We may only want a small part of it. For example, we may want only the first 100 characters. Python makes this easy by using something called slicing. Slicing means taking a part of the string. We use square brackets [] with numbers inside to do this. It is a very useful and simple way to get the part of a string that we need. In this article, we will show you how to get ... Read More
413 Views
A list is a data structure in Python that is a mutable or changeable ordered sequence of elements. A list's items are any elements or values that are contained within it. Lists are defined by having values inside square brackets [], just as strings are defined by characters inside quotations. They are used to store multiple items in a single variable. In Python, strings are among the most widely used types. We can create them simply by enclosing characters in quotes. Python treats single quotes the same as double quotes. Creating strings is as simple as assigning a value to ... Read More
56K+ Views
In Python, a list is an ordered sequence that can hold several object types, such as integers, characters, or floats. In other programming languages, a list is equivalent to an array. Square brackets [] are used to denote it, and a comma (, ) is used to divide two items in the list. In this article, we will show you how to get a comma-separated string from a list using Python. Comma-Separated String using join() ... Read More
254 Views
In programming, it is very common to work with lists, which are collections of items. But sometimes, you may want to turn a list into a single string. So in this chapter, we will show you how you can do this in Python. We will use some simple explanations and examples to make this easy, so you can understand it very well. Understanding Lists So first, we need to understand what exactly a list is in Python. So, in simple terms, we can say it is a way to store multiple values. For example, you can have a list of ... Read More