Home
Flashcards
Preview
C# Programming
Home
Get App
Take Quiz
Create
public static void Main( )
This is a... ?
Method header
public static void Main ( )
What word above is the method's name?
" Main "
Console.WriteLine("Programming is great fun!");
The group of characters inside of the quotation marks is called a... ?
" string literal "
Do class headers / method headers end with a semicolon " ; " ?
No, class headers and method headers do not end with a semicolon because they are terminated with a body of code inside braces.
What do these forward slashes "
//
" mean?
Marks the beginning of a comment.
ex.)
Console.WriteLine("Hello Martha!");
//This line will display saying "Hello Martha!"
What do these opening and closing parentheses "
( )
" mean?
Used in a method header.
ex.)
public static void Main
( )
What do these opening and closing braces "
{ }
" mean?
Enclose a group of statements, such as the contents of a class or a method.
ex.)
public static void Main ( )
{
Console.WriteLine("Hello Martha!");
}
What do these quotation marks
"
" "
"
mean?
Enclose a string of characters, such as a message that is printed on the screen.
ex.)
Console.WriteLine(
"
Today is my birthday!
"
);
What does this semicolon
"
;
"
do?
Marks the end of a complete programming statement.
What is the difference between
"
Write
"
and
"
WriteLine
"
?
The
Write
method
does not advance
the cursor to the next line after the message is displayed, the
WriteLine
method
does
.
ex.)
public static void Main ( )
{
Console.Write("These are our top sellers
: \n");
Console.Write("Computer games \n");
Console.WriteLine("Coffee \n");
Console.Write("Aspirin \n");
}
Program Output:
These are our top sellers
:
Computer games
Coffee
**Notice it does not display Aspirin. This is because you used a WriteLine before it, which made it so it didn't advance to the next line in code.
What does an
escape sequence
do and how do you display one?
An
escape sequence
allows you to
control the way output is displayed
by
embedding
comands
within the string
itself.
To use an escape sequence you start with a
backslash characte
r "
\
" and then followed by one or more
control characters
.
ex.)
\n
"
\n
"
What does this escape character allow you to do?
Newline - advances the cursor to the next line for subsequent printing.
Author
ASLeathe
ID
16401
Card Set
C# Programming
Description
Programming - C#
Updated
2010-04-27T09:54:14Z
Show Answers
Home
Flashcards
Preview