Exercise Java programming

Slides:



Advertisements
Similar presentations
Continuation of chapter 6…. Nested while loop A while loop used within another while loop is called nested while loop. Q. An illustration to generate.
Advertisements

Picture It Very Basic Game Picture Pepper. Original Game import java.util.Scanner; public class Game { public static void main() { Scanner scan=new Scanner(System.in);
© 2007 Lawrenceville Press Slide 1 Chapter 3 Classes and Objects.
Java Intro. A First Java Program //The Hello, World! program in Java public class Hello { public static void main(String[] args) { System.out.println("Hello,
BASIC JAVA. Hello World n // Hello world program public class MyFirstJavaProgram { public static void main(String args[]) { char c = 'H'; String s =
Copyright 2006 by Pearson Education 1 reading: 4.1 Cumulative sum.
Random (1) Random class contains a method to generate random numbers of integer and double type Note: before using Random class, you should add following.
Slide 1 of 40. Lecture A The Java Programming Language Invented 1995 by James Gosling at Sun Microsystems. Based on previous languages: C, C++, Objective-C,
16-Aug-15 Java Puzzlers From the book Java Puzzlers by Joshua Bloch and Neal Gafter.
Derived from Building Java Programs by Stuart Reges & Marty Stepp
Shorthand operators.
2.2 Information on Program Appearance and Printing.
Laboratory Study October, The very first example, traditional "Hello World!" program: public class first { public static void main (String[ ]
1 BUILDING JAVA PROGRAMS CHAPTER 2 PRIMITIVE DATA AND DEFINITE LOOPS.
Introduction to Java Thanks to Dan Lunney (SHS). Java Basics File names The “main” method Output to screen Escape Sequence – Special Characters format()
Introduction to Computers and Java Chapter 1.3. A Sip of Java: Outline History of the Java Language Applets A First Java Program Compiling a Java Program.
1 Introduction to Java Brief history of Java Sample Java Program Compiling & Executing Reading: => Section 1.1.
The string data type String. String (in general) A string is a sequence of characters enclosed between the double quotes "..." Example: Each character.
Java Spring PImage Let’s look at the PImage class in ProcessingPImage –What are the fields (i.e., variables)? –What methods are available? –What.
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
Interfaces. –An interface describes a set of methods: no constructors no instance variables –The interface must be implemented by some class. 646 java.
Answers to Assignment #1 (Assignment due: Wed. Feb. 05, 2003) 1. What does the "plateform independence" mean? How is it implemented in Java? 2. Summarize.
BUILDING JAVA PROGRAMS CHAPTER 2 Days of For Loops Past.
The scope of local variables. Murphy's Law The famous Murphy's Law says: Anything that can possibly go wrong, does. (Wikipedia page on Murphy's Law:
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Variables, Arithmetic, etc.)
JAVA PROGRAMMING BASICS CHAPTER 2. History of Java Begin with project Green in 1991 founded by Patrick Noughton, Mike Sheridan and James Gosling who worked.
Output in Java Hello World!. Structure of a Java Program  All Java files in ICS3U1 have the following structure: class HelloWorld { }  Notice the open.
Mixing integer and floating point numbers in an arithmetic operation.
Warm Up As you enter get out a half sheet of loose paper. Write the HelloWorld program on it. Be prepared to correct your code.
Indentation & Readability. What does this program do? public class Hello { public static void main ( String[] args ) { //display initial message System.out.println(
Lab 01-2 Objectives:  Writing a Java program.  How to send output to the command line console.  Learn about escape sequences.  Learn how to compile,
Introduction to Computing Concepts Note Set 15. JOptionPane.showMessageDialog Message Dialog Allows you to give a brief message to the user Can be used.
The assignment expressions. The assignment operator in an assignment statement We have seen the assignment statement: Effect: var = expr; Stores the value.
Output Programs These slides will present a variety of small programs. Each program has a control structure that was introduced in this chapter. Our concern.
FOR LOOP WALK THROUGH public class NestedFor { public static void main(String [] args) { for (int i = 1; i
Java and C++ Transitioning. A simple example public class HelloWorldApp { public static void main(String[] args) { //Display the string. System.out.println("Hello.
Output Programs These slides will present a variety of small programs. Each program has some type of array that was introduced in this chapter. Our concern.
Developed at Sun Microsystems in 1991 James Gosling, initially named “OAK” Formally announced java in 1995 Object oriented and cant write procedural.
1 Advanced Programming Examples Output. Show the exact output produced by the following code segment. char[,] pic = new char[6,6]; for (int i = 0; i
© 2007 Lawrenceville Press Slide 1 Chapter 3 Classes and Objects 1. How is a class different from an object?
CS001 Introduction to Programming Day 6 Sujana Jyothi
Computer Programming Lab 9. Exercise 1 Source Code package excercise1; import java.util.Scanner; public class Excercise1 { public static void main(String[]
Interactive Programs Programs that get input from the user 1 In PowerPoint, click on the speaker icon then click the "Play" button to hear the narration.
Computer Science A 1. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated editor,
Output Programs These slides will present a variety of small programs. Each program has a compound condition which uses the Boolean Logic that was introduced.
Programming – Lecture 15 Going Beyond the ACM Library.
Output Programs These slides will present a variety of small programs. Each program has a control structure that was introduced in this chapter. Our concern.
UFCFY5-30-1Multimedia Studio Coding for Interactive Media Fundamental Concepts.
Introduction to Programming using Java Day 3 and 4 Java Language Basics Review The “For” loop Subroutines The “String” class.
Java Methods and Applications CSIS 3701: Advanced Object Oriented Programming.
10/16/07.
Introduction to programming in java
Computer Programming Your First Java Program: HelloWorld.java.
Introduction of Java Fikri Fadlillah, S.T.
Object-Oriented programming for Beginners LEAPS Computing 2015
A Java Program: // Fig. 2.1: Welcome1.java // Text-printing program.
using System; namespace Demo01 { class Program
Maha AlSaif Maryam AlQattan
Code Magnets problem for wk5
Programming Vocabulary.
TO COMPLETE THE FOLLOWING:
An Introduction to Java – Part I, language basics
Tonga Institute of Higher Education
AP Java Warm-up Boolean Array.
CS110D Programming Language I
class PrintOnetoTen { public static void main(String args[]) {
Introduction to Java Brief history of Java Sample Java Program
A Java Application public class Hello { public static void main(String [] args) { System.out.println("Hello, World!"); } } public class.
A Java Application public class Hello { public static void main(String [] args) { System.out.println("Hello, World!"); } } public class.
Presentation transcript:

Exercise Java programming MISY 2312 Introductory Programming for Information Systems Exercise Java programming Hadeel Amer Al-Amrei ID: 200900410

Q1:What is Java ? Java is The java programming language was created by Sun Microsystems, Inc. A programming language specifies the words and symbols that we can use to write a program. Is a programming language expressly designed for use in the distributed environment of the Internet. All above Correct Answer

(Numerical) Q1:what the output ? public class NumericalExamples { public static void main (String [] args) { System.out.print("2 + 3.0 = "); System.out.println(2 + 3.0); System.out.print("2 + 3 = "); System.out.println(2 + 3); } } Output: 2 + 3.0 = 5.0 2 + 3 = 5

Q3: what is output ? 40 45 ((9 * (9 + 1)) / 2) public class SeriesSum { public static void main (String [] args) { int n = 9; System.out.println((n * (n + 1)) / 2); } B Correct Answer 40 45 ((9 * (9 + 1)) / 2)

Q4: what is correct code? B is correct A. class helloWorld{ public static void main(String args[ ]){ System.out.println(Hello World!); } B. class helloWorld{ System.out.println(“Hello World!”); C. class helloWorld{ System.out.println(“Hello World!”) B is correct