Skip to main content

Posts

Showing posts with the label java

Merge sort algorithm

This video show how merge sort works out: ----------------------------------------

Java Program to FILTER PRIMES

Hi guys, This simple java program accepts a number as a limit and analyse each number. If it is prime a flag is set and it is displayed. Also it shows the total number of primes obtained within the range. Here's the program. PROGRAM Click  here  for  instructions for executing  the program. --------------------------------------- If not working/incorrect execution please notify me below. Also share your experience. Have a nice day.

Java Program using constructors

Simple Java Program using constructors. Here the constructor is “Cars”. //constructors public class Cars                 {                 public Cars(String name)                                 {                                 System.out.println("super "+name);                                 }               ...

The Simplest Java Program! - Displaying a Text

This is a simple Java program to display a text: 'i=100'. This program enable you to understand: How to declare variable. Structure. Output statement. class Awesome {                 static int i;                 public static void main(String[] args)                 {                                 i=100;                                 System.out.println("i="+i);                 } } Cl...

Instructions for Executing the Java Program.

If you don't have JDK in your system, then first you need to download and install Java Development Kit. Instructions to DOWNLOAD and INSTALL JDK. Instructions for Executing the Java Program. Locate the class in which the main() function is present. Save the program in the name of the class with an extension (* .java ). In this example the progm should be saved as ‘ Test.java ’. Open the cmd [Command Prompt] and set the address of the saved progm. Type ‘javac < file_name >’ –enter. [e.g.: javac Test.java] If any errors are there, that will be displayed here. After correcting all the errors, Save the progm again and compile. Now type ‘java <file_name_without_extention>’ [e.g.: java Test ]. Your program is now executed.

Simple Java Program That Display a Text

This is a simple java program that display a text (“I’m Vajahath” here). class Test {                 public static void main(String []args)                 {                                 System.out.println(“wow! It’s working..!”);                 } } Click here for instructions for executing the program.

Procedure for testing your JDK Installation

Test Your JDK Open Command Prompt, type ‘ java ’ – enter. à If it is working, do the following tip. Try this program: Open Notepad and type the following codes: class Awe {                 public static void main(String []args)                 {                                 System.out.println(“wow! It’s working..!”);                 } } Save the file as “ Awe.java ”. Open Command Prompt and set the corresponding file address. Type ‘ javac Awe.java ’ –enter. (Now the code is compiled) Type ‘ java Awe ’ –enter. (Now the program is executed) If you are getting an ...

Procedure to install the Java Development Kit (JDK)

Simple Easy Steps for Installation of JDK Download JDK (latest version recommended) from  http://www.oracle.com/technetwork/java/javase/downloads/index.html  . Install it. Go to control panel . Then move to “ Control Panel\System and Security\System ”. Click “ Advanced System Settings ” in the margin. In the “ Advanced ” tab, click “ Environment variables ” button. Then in “ system variables ” area, select “ path ” and click “ edit ”. (Use with care)  (Windows 10 has a different interface, but similar). Separate the current content with a “ ; ” and include just right after that, the file address of the ‘ bin ’ file in java folder. See the example:  [Example: ….; C:\Program Files (x86)\Sony\VAIO Startup Setting Tool;C:\Program Files (x86)\Windows Live\Shared; C:\Program Files\Java\jdk1.7.0_45\bin; ] Then ‘OK’.