Java

Java program to generate random numbers

Objectives:

  • Write a Java program to to generate random numbers and print the same
  • Write a program to generate random numbers
  • Write a program to generate random numbers in Java

Java Program:

[sourcecode lang="java"]

import java.util.Scanner;
import java.util.Random;

class GenerateRandomNumber
{
public static void main(String[] args)
{
int maxRange;

//create objects
Scanner SC = new Scanner(System.in);
Random rand = new Random();

System.out.print("Please enter maximum range: ");
maxRange=SC.nextInt();

for(int i=1; i<=10; i++)
{
System.out.println(rand.nextInt(maxRange));
}
}
}

[/sourcecode]

Output:

Please enter maximum range: 500
467
61
100
449
68
316
445
224
54
498

Find duplicate characters in string

Objectives:

  • Write a Java program to find duplicate characters in the string and print the duplicate characters
  • Write a program to find duplicate characters in String

Java Program:

[sourcecode lang="java"]
public class DuplicateCharacters {
    public static void main(String args[]) {

        String str = "NITIN";
        int count = 0;

        char input[] = str.toCharArray();
        System.out.println("Duplicate Characters are:");

        for (int i = 0; i &amp;lt; str.length(); i++) {
            for (int j = i + 1; j &amp;lt; str.length(); j++) {
                if (input[i] == input [j]) {
                    System.out.println(input[j]);
                    count++;
                    break;
                }
           }
        }
    }
}
[/sourcecode]

Output:

Duplicate Characters are: N I

Learning with uCertify

My Experience with uCertify :

I had an access to uCertify 1Z0-808 – Oracle Certified Associate Java SE 8 Programmer course, and I think it’s a pretty good supplement study guide for the course. The questions and flash cards make good revision and I am especially fond of the exam mode and exam readiness assessment that really helps to determine the how well one grasps the information and concepts. For a technical course of this nature, some labs would help to drive home the real-world application of the skills learn

ucertify

About Exam:

Oracle Java SE 8 Programmer I exam is designed to certify the competency of Java professionals in developing Java applications, mastering  Java data types, operators and decision control structures, and understanding OOPs concepts of Java. Java SE 8 significantly changes the way Java Programmers write code. Earning a Java SE 8 Certification gives you the tools to make the most of the new features within Java SE 8.

The Java SE 8 Oracle Certified Associate (OCA) certification helps you build a basic understanding of Java, while expanding your knowledge of general programming.

The ideal candidate who would earn this certification typically has a technical background and wants to improve programming skills, or may be new to object-oriented programming and Java.

 

About uCertify:

uCertify is a leading provider of online Test preps, Courses & Labs for IT and Project Management certification exams.Our courses are authored by the industry experts (with 15+ years of experience)  and we have a fan base of  600,000 happy customers in 200 countries worldwide.

 

Java Program to convert Decimal to Binary

Objectives :

  • Decimal to Binary Conversion
  • Converting Decimal to Binary
  • Converting Decimal Number to Binary format
  • Write a program to convert decimal to binary
  • Write a program to convert decimal number to binary format
  • Write a program to convert positive decimal number to binary format
  • Write a program to convert decimal to binary using Scanner class
  • Write a program to convert decimal to binary, take input using Scanner class

 

Java Program to convert Decimal to Binary : 

[sourcecode lang=”java”]
public class DecimalToBinary {

public void toBinary(int number){
int binary[] = new int[25];
int n = 0;
// Convert Decimal to Binary
while(number > 0){
binary[n++] = number%2;
number = number/2;
}
// Print Binary number
for(int i = n-1;i >= 0;i–){
System.out.print(binary[i]);
}
}

public static void main(String[] args){
DecimalToBinary obj = new DecimalToBinary();
obj.toBinary(14);
}
}
[/sourcecode]

Output :

1110

 

Java Program to convert Decimal to Binary using Scanner class :

[sourcecode lang=”java”]

import java.util.Scanner;

public class DecimalToBinary {

public void toBinary(int number){
int binary[] = new int[14];
int n = 0;

// Convert Decimal to Binary
while(number > 0){
binary[n++] = number%2;
number = number/2;
}

// Print Binary Number
for(int i = n-1;i >= 0;i–){
System.out.print(binary[i]);
}
}

public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter a number: ");
int num= scanner.nextInt();
DecimalToBinary obj = new DecimalToBinary();
obj.toBinary(num);

}
}

[/sourcecode]

Output :

Enter a number: 14

1110

Workshop on NetBeans IDE & Platform

[youtube:http://www.youtube.com/watch?v=7qdF-f0FEVE&feature=youtu.be]

Conducted one day Workshop on NetBeans IDE & Platform at Dr. Ambedkar College of Engineering & Research, Nagpur on 18thDec. 2013 as a part of Workshop on Open Source Tools and Technologies, received good response from the audience and people are asking for more now.

Under the series of Workshops on Open Source Tools and Technologies various workshops were conducted at the college during 18th Dec. 2013 to 20th Dec. 2013.

JUDCon2014 India

judcon2014india_banner

<!–

–>

Early Bird offer closes 18 Nov 2013

Meet the open source stars coming to JUDCon2014:India! Take advantage of the Early Bird offer and register today!

Come listen to Arun Gupta, widely-acclaimed Java engineer and author of a best-selling book, who is passionately committed to Java and Java EE. He is now Director of Developer Advocacy at Red Hat and will lead a stellar line up of Red Hat engineers coming to JUDCon India.

Returning to Banglalore for the 3rd consecutive year, JUDCon India is the world’s largest developer conference focusing on Enterprise Application Development within the JBoss Community. Take part in two days of informative sessions, labs and more!

The JBoss Users and Developers Conferences are developer gatherings held around the globe to give JBoss users the chance to talk to and collaborate with leaders in the JBoss Community, and to allow the project leads and engineers to learn from and collaborate with end users.

Register today – don’t miss the Early Bird offer!

REGISTER NOW
When: January 30-31, 2014

Where: MLR Convention Center, Whitefield Bangalore

Why: Because developers need to get their hands dirty in code

SPEAKERS
Arun_Gupta
Arun Gupta
Director of Developer Advocacy at Red Hat, founding member of the Java EE team at Sun Microsystems, he also led a cross-functional team at Oracle to drive the global launch of the Java EE 7 platform.
   
Andrew_Lee_Rubinger
Andrew Lee Rubinger
Open-source engineer and author of the upcoming “Continuous Enterprise Development in Java”. Founder of the ShrinkWrap project and recovering member of the JBoss Core Development Team.
   
Peter_Muir
Peter Muir
Senior Principal Software Engineer at Red Hat, lead for the CDI 1.1 specification and works on JBoss Developer Framework. Pete is also founder of the Arquillian project.
   
Conference Type Day/Date Early Bird Fee Standard Fee
2-Day Pass 30 & 31 Jan 999 INR 1499 INR
For more information,or any queries about JUDCon India, e-mail judcon2014india@theyounion.in or call us at +91 99000 79091

Core Java Workshop at TGPCET

Conducted a Workshop on Core Java at Tulsiramji Gaikwad Patil College of Engineering & Technology, Nagpur on 25 Mar. 2013 & 26 Mar. 2013. It was nice to provide Classroom Training & Workshop on Core Java to students of TGPCET.

Have a look at glimpse of workshop here :

[gigya src=”http://player.videofy.me/player.swf?videoId=1100848″ width=”480″ height=”360″ quality=”high” wmode=”transparent” allowFullScreen=”true”]

Watch this as You Tube video:

[youtube http://www.youtube.com/watch?v=NhnIxMeX4Hc&w=420&h=315]

Hello World in different languages

Free Source Code

Free Source Code

Objectives :
* How to write Hello World in Java?
* How to write Hello World in C?
* How to write Hello World in PHP?
* How to write Hello World in C++?
* How to write Hello World in JavaScript?
* How to write Hello World in HTML?
* How to write Hello World in CSS?
* How to write Hello World in COBOL?

Java

[sourcecode language=”java”]
class HelloWorld
{
public static void main(String args[])
{
System.out.println(“Hello World!”);
}
}
[/sourcecode]

C

[sourcecode language=”c”]
#include
#include
void main()
{
clrscr();
printf(“Hello World!”);
getch();
}
[/sourcecode]

C++

[sourcecode language=”cpp”]
#include
#include
void main()
{
clrscr();
cout<getch();
}
[/sourcecode]

CSS

[sourcecode language=”css”]
body:before
{
content: “Hello World”;
}
[/sourcecode]

COBOL

[sourcecode language=”text”]
****************************
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
MAIN SECTION.
DISPLAY “Hello World!”
STOP RUN
****************************
[/sourcecode]

HTML

[sourcecode language=”html”]
<html>
<head>
<title>Hello World Example</title>
</head>
<body>
Hello World!
</body>
</html>
[/sourcecode]

JavaScript

[sourcecode language=”javascript”]
document.write("Hello World");
[/sourcecode]

PHP

[sourcecode language=”php”]
<!–?php echo ‘Hello World!’ ?–>
[/sourcecode]

Linux Shell Script

[sourcecode language=”text”]
echo "Hello World !"
[/sourcecode]

Enjoy coding!

Posted from WordPress for Android

Why Java is Platform Independent?

Objectives :

  • Why Java is platform independent?
  • How java program executes?
  • What is execution flow of Java Program?
  • What are the steps to execute a Java Program?
  • What are the steps to run a Java Program?

[gigya src=”http://player.videofy.me/player.swf?videoId=424278″ width=”480″ height=”300″ quality=”high” wmode=”transparent” allowFullScreen=”true” ]