Posts

Showing posts with the label Source code

Multi-threading in Java (source code example)

Image
Multi-threading in java is a process of executing multiple threads simultaneously. Thread is basically a lightweight sub-process, a smallest unit of processing. Multiprocessing and multi-threading, both are used to achieve multitasking. But we use multi-threading than multiprocessing because threads share a common memory area. They don't allocate separate memory area so saves memory, and context-switching between the threads takes less time than process. Java Multi-threading is mostly used in games, animation etc. Advantages: 1) It doesn't block the user because threads are independent and you can perform multiple operations at same time. 2) You  can perform many operations together so it saves time. 3) Threads are independent so it doesn't affect other threads if exception occur in a single thread. Source Code: package multiThreading; //Class no: 1 class Thread1 extends Thread {     ...

Add a flying animated twitter on your Website or blog

Image
Let's Programming  bring a animated twitter for the websites . The flying twitter bird is present for the website. You can add this on your blog or even in your website. Just follow the instructions and get a attractive look of your website. For Add in the blog: Add a new HTML/JavaScript from (Custom HTML) Widget Copy the given code to your new HTML/JavaScript Widget Save your widget For add in the other websites:   If you are not on the blogger platform, change  < data : blog . pageTitle />: <data : blog . url/>   to your website url.   Now we are set, save and watch our wonder bird work its magic. Source code: <!-- Twitter Bird start ewtnet.com --> <script src='http://yourjavascript.com/1523826141/Flying twitter bird.js' type='text/javascript'> </script> <script type='text/javascript'> var twitterAccount = "ali_supersmart"; var tweetThisText = " <data:blog.pag...

Components of class | Class | Object | Getter | Setter | toString | Custom method

Image
Let's discuss Components of class | Class | Object | Getter | Setter | toString | Custom method : The concept of object oriented programming (OOP) often difficult for the newly coming students in the programming. Now the new and more efficient way of programming is OOP, in which deal with the objects of the classes and code our desired program. There are some basic components are  involve in the OOP just as class, objects, member variable or fields, getter ,setter, toString method, and custom methods. There are lot of theatrical examples and explanations of the OOP which hardly understand. Let's Programming bring a practical scenario of OOP with the basic components of class.We hope that you learn more by this.    (note: please copy it and paste on by one class on your compiler and learn the components of the custom class) Class No: 1 (The custom class) public class getter_setter {           ...

While loop | Multiple text enter and then show | Text and show on runtime | Program | Source code

# include <iostream> using namespace std; void main () {     int n=1;     char name [10];// you can enter only 10 characters as a name             while (n<=10)     {     cout<<n<<"-Please enter your name: ";     cin>>name;     cout<<"\tWelcome "<<name<<endl<<endl;                 n++;     } }