Unit 1: Intro Lesson 4: Output.

Slides:



Advertisements
Similar presentations
This Time Whitespace and Input/Output revisited The Programming cycle Boolean Operators The “if” control structure LAB –Write a program that takes an integer.
Advertisements

Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Java Programming Practice.
Chapter 2 - Introduction to Java Applications
True BASIC Ch. 6 Practice Questions. What is the output? PRINT X LET X = -1 PRINT X FOR X = 4 TO 5 STEP 2 PRINT X NEXT X PRINT X END.
Using JOptionPanes for graphical communication with our programs. Pages Horstmann 139.
CS 106 Introduction to Computer Science I 01 / 29 / 2008 Instructor: Michael Eckmann.
School of Computing Science CMT1000 © Ed Currie Middlesex University Lecture 3: 1 CMT1000: Introduction to Programming Ed Currie Lecture 3: Program structure.
Chapter 2 - Introduction to Java Applications
Relational Operators Control structures Decisions using “if” statements  2000 Prentice Hall, Inc. All rights reserved. Modified for use with this course.
Computer Science A 1: 3/2. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated.
Grep, comm, and uniq. The grep Command The grep command allows a user to search for specific text inside a file. The grep command will find all occurrences.
INTRODUCTION TO PYTHON PART 2 INPUT AND OUTPUT CSC482 Introduction to Text Analytics Thomas Tiahrt, MA, PhD.
JOptionPane class. Dialog Boxes A dialog box is a small graphical window that displays a message to the user or requests input. A variety of dialog boxes.
Week #2 Java Programming. Enable Line Numbering in Eclipse Open Eclipse, then go to: Window -> Preferences -> General -> Editors -> Text Editors -> Check.
Week #2 Java Programming. Enable Line Numbering in Eclipse Open Eclipse, then go to: Window -> Preferences -> General -> Editors -> Text Editors -> Check.
OOP (Java): Simple/ OOP (Java) Objectives – –give some simple examples of Java applications and one applet 2. Simple Java Programs Semester.
Input/Output in Java. Output To output to the command line, we use either System.out.print () or System.out.println() or System.out.printf() Examples.
 2000 Prentice Hall, Inc. All rights reserved. 1 Chapter 2 - Introduction to Java Applications Outline 2.1Introduction 2.2A Simple Program: Printing a.
Can we talk?. In Hello World we already saw how to do Standard Output. You simply use the command line System.out.println(“text”); There are different.
Programming Fundamentals 2: Simple/ F II Objectives – –give some simple examples of Java applications and one applet 2. Simple Java.
Chapter 3 Java Input/Output.
CSC1030 HANDS-ON INTRODUCTION TO JAVA Introductory Lab.
Chapter 4 Practice cont.. Practice with nested loops 1.What will be the output of the following program segment: 1.for (int i = 1; i
Dialog Boxes.
CSC 1051 – Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website:
Introduction to Computing Concepts Note Set 15. JOptionPane.showMessageDialog Message Dialog Allows you to give a brief message to the user Can be used.
Strings and I/O. Lotsa String Stuff… There are close to 50 methods defined in the String class. We will introduce several of them here: charAt, substring,
GCSE Computing: Programming GCSE Programming Remembering Python.
Simple Console Output. What we will briefly discuss System.out.println( … ) System.out.print( … ) System.out.printf( … )
Simple Console Output CS 21a. What we will briefly discuss System.out.println( … ) System.out.print( … ) System.out.printf( … )
Object Oriented Programming (OOP) LAB # 3 TA. Maram & TA. Mubaraka TA. Kholood & TA. Aamal.
CS 106 Introduction to Computer Science I 02 / 15 / 2008 Instructor: Michael Eckmann.
Computer Programming Your First Java Program: HelloWorld.java.
A Java Program: // Fig. 2.1: Welcome1.java // Text-printing program.
Program: Shape Area Print the area for various shape types using the respective formulas.
1-1 Logic and Syntax A computer program is a solution to a problem.
CSC305: COMPUTER PROGRAMMING II (JAVA)
2.5 Another Java Application: Adding Integers
Command Line Arguments
Section 64 – Manipulating Data Using Methods – Java Swing
Chapter 3 Java Input/Output.
Formatting Output.
Engineering Innovation Center
OUTPUT STATEMENTS GC 201.
Lesson 2: Program design process & Intro to code
Chapter 7 - JavaScript: Introduction to Scripting
G7 programing language Teacher / Shamsa Hassan Alhassouni.
JavaScript: Introduction to Scripting
Programming Right from the Start with Visual Basic .NET 1/e
Chapter 2 - Introduction to Java Applications
Lecture Notes 8/24/04 (part 2)
Unit 1: Intro Lesson 3: Input.
AP Java 10/4/2016.
CS110D Programming Language I
Chapter 3 Input/Output.
Chapter 3 – Introduction to C# Programming
Chapter 2: Java Fundamentals
The keyboard is the standard input device.
Chapter 7 - JavaScript: Introduction to Scripting
Basic Lessons 5 & 6 Mr. Kalmes.
Chapter 7 - JavaScript: Introduction to Scripting
JOptionPane class.
F II 2. Simple Java Programs Objectives
Basic 9 Mr. Husch.
Starter Which of these inventions is: Used most by people in Britain
What you need to do… Drag the pieces of code into the correct order like you can see in the EXAMPLE below. print ( “ int input ) = + Hello world chr ord.
Chapter 2: Java Fundamentals cont’d
The main Function, introcs Library, and Prompting
Chapter 7 - JavaScript: Introduction to Scripting
Presentation transcript:

Unit 1: Intro Lesson 4: Output

Output Methods Output methods allow the program to display information such as text, symbols, numbers, the result of calculations or the value of variables Most often Output is used to ask to the user for certain information, or to display a result Output Method 1: System.out.print(“ “); Output Method 1: System.out.println(“ “); Output Method 2: JOptionPane.showOutputDialog(“ “);

Print Simple Consecutive print statements display on the same line Can only be used in an IDE or the Command Line

Print Line Simple Consecutive print statements display on separate lines Can only be used in an IDE or the Command Line

JOptionPane.showOutputDialog(“ “); Slightly more complicated Works outside of the IDE or Command Line User – friendly interface Displays a popup window with the output dialog

Use of Print Create an initialized variable of any data type to display its value (Optional) Create an output statement System.out.print(“How about some input?”); int myVariable = 100; System.out.print(myVariable); String myVariable = (“Hello there!!!”);

Use of Print Line Create an initialized variable of any data type to display its value (Optional) Create an output statement System.out.println(“How about some input?”); int myVariable = 100; (Optional) System.out.println(myVariable); String myVariable = (“Hello there!!!”); (Optional)

Use of JOptionPane Output Import statement Create an initialized variable of any data type to display its value (Optional) Create an output statement Import javax.swing.JOptionPane; JOptionPane.showOutputDialog(“You don’t need a variable for me”); int myVariable = 100; (Optional) JOptionPane.showOutputDialog(myVariable); String myVariable = (“Hello there!!!”); (Optional)