Chapter 1: Review Questions
1. The most basic circuitry-level computer language, which consists of on and off switches, is machine language. (b)
2. Languages that let you use a vocabulary of descriptive terms, such as read, write, or add, are known as high-level languages. (a)
3. The rules of a programming language constitue its syntax. (d)
4. A compiler translates high-level language statements into machine code. (c)
5. Named computer memory locations are called variables. (b)
6. The individual operations used in a computer program are often grouped into units called procedures. (a)
7. Envisioning program components as objects that are similar to concrete objects in the real world is the hallmark of object-oriented programming (c).
8. The value of an object's attributes are also known as its state. (b)
9. An instance of a class is a(n) object. (a)
10. Java is architecturally neutral. (c)
11. You must compile classes written in Java into bytecode. (a)
12. All Java programming statements must end with semicolon. (c)
13. Arguments to methods always appear within parenthesis. (a).
14. In a Java program, you must use dots to separate classes, objects, and methods. (c)
15. All Java applications must have a method named main(). (b)
16. Nonexecuting program statements that provide documentation are called comments. (c)
17. Java supports three types of comments: line, block and javadoc. (a)
18. After you write and save a Java application file, you compile and then interpret it. (d)
19. The command to execute a compiled Java application is java. (d)
20. You save the text files containing Java source code using the file extension .java. (a)
Exercises (coming soon)
1.
a. weeklySales - legal
b. last character - illegal
c. class - illegal
d. MathClass - legal
e. myfirstinitial - legal
f. phone# - illegal
g. abcdefghiklmnop - legal
h. 23jordan - illegal
i. my_code - legal
j. 90210 - illegal
k. year2013budget - legal
l. abffraternity - legal
2.
a. TelevisionSet: size, make, numOfInputs
b. EmployeePaycheck: name, amount, department
c. PatientMedicalRecord: name, age, weight
3.
a. Politician: chrisChristie, mittRomney, barackObama
b. SportingEvent: superbowl, worldSeries, pGATour
c. Book: fightClub, oneFlewOverTheCuckoosNest, harryPotter
4.
a. mickeyMouse: Mouse, DisneyCharacter, Animal
b. myDogSpike: Dog, Animal, Pet
c. bostonMassachusetts: City, StateCapital, BaseballTeamHomeCity
public class Name /*Displays my name*/ { public static void main(String[] args) { System.out.println("Name Line 1"); } }
public class Address /*Displays my name and address*/ { public static void main(String[] args) { System.out.println("Address Line 1"); System.out.println("Address Line 2"); System.out.println("Address Line 3"); } }
public class Tree /*Displays a tree pattern on the screen*/ { public static void main(String[] args) { System.out.println(" X "); System.out.println(" XXX "); System.out.println(" XXXXX "); System.out.println("XXXXXXX"); System.out.println(" X "); } }
public class Initial /*Displays my initials */ { public static void main(String[] args) { System.out.println(" AA M M"); System.out.println(" A A M M M M"); System.out.println(" AAAAAA M M M"); System.out.println(" A A M M"); System.out.println("A A M M"); } }
public class Diamond /*Displays a Diamond */ { public static void main(String[] args) { System.out.println(" * "); System.out.println(" * * "); System.out.println("* * *"); System.out.println(" * * "); System.out.println(" * "); } }
//Displays the following comment:Program comments are nonexecuting statements you add to a file for the purpose of documentation. /*Displays the following comment: Program comments are nonexecuting statements you add to a file for the purpose of documentation. */ /**Displays the following comment: Program comments are nonexecuting statements you add to a file for the purpose of documentation. */ public class Comments { public static void main(String[] args) { System.out.println("Program comments are nonexecuting statements you add to a file for the purpose of documentation."); } }
//Displays the following comment: Program comments are nonexecuting statements you add to a file for the purpose of documentation. /*Displays the following comment: Program comments are nonexecuting statements you add to a file for the purpose of documentation. */ /**Displays the following comment: Program comments are nonexecuting statements you add to a file for the purpose of documentation. */ import javax.swing.JOptionPane; public class CommentsDialog { public static void main(String[] args) { JOptionPane.showMessageDialog(null, "Program comments are nonexecuting statements you add to a file for the purpose of documentation."); } }
import javax.swing.JOptionPane; public class BurmaShave /*Displays a Burma Shave rhyme in a dialog box*/ { public static void main(String[] args) { JOptionPane.showMessageDialog(null, "Shaving brushes"); JOptionPane.showMessageDialog(null, "You'll soon see 'em"); JOptionPane.showMessageDialog(null, "On a shelf"); JOptionPane.showMessageDialog(null, "In some museum"); JOptionPane.showMessageDialog(null, "Burma Shave"); } }
public class CardLayout /*Displays an attractive layout of information in a typical business card*/ { public static void main(String[] args) { System.out.println("Name Line 1"); System.out.println("Address Line 1"); System.out.println("Address Line 2"); System.out.println("Home: Home Phone 1"); System.out.println("Work: Home Phone 2"); } }
import javax.swing.JOptionPane; public class RandomGuess /* Guessing game where a user is challenged to guess a random number*/ { public static void main(String[] args) { JOptionPane.showMessageDialog(null, "Think of a number between 1 and 10."); JOptionPane.showMessageDialog(null, "Is it: " + (1 + (int)(Math.random()*10))); } }
I have read your article, it is very informative and for me.I admire the valuable information you offer in your articles. Thanks for posting it..
ReplyDeletejava tutorial
It seems you are so busy in last month. The detail you shared about your work and it is really impressive that's why i am waiting for your post because i get the new ideas over here and you really write so well.
ReplyDeleteData Science course in rajaji nagar
Data Science with Python course in chenni
Data Science course in electronic city
Data Science course in USA
Data science course in pune | Data Science Training institute in Pune
Very nice post here and thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.
ReplyDeleterpa training in bangalore
best rpa training in bangalore
rpa training in pune | rpa course in bangalore
rpa training in chennai
Thanks for the good words! Really appreciated. Great post. I’ve been commenting a lot on a few blogs recently, but I hadn’t thought about my approach until you brought it up.
ReplyDeleteBest Devops Training in pune
Devops Training in Bangalore
Microsoft azure training in Bangalore
Power bi training in Chennai
Hmm, it seems like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well as an aspiring blog writer, but I’m still new to the whole thing. Do you have any recommendations for newbie blog writers? I’d appreciate it.
ReplyDeleteAWS Course Interview Questions and Answers for Freshers | AWS Interviews Questions and Answers for Devops
AWS Tutorial – Besant Technologies
AWS Interview questions and answers for Sysops |AWS Interview Question and Answers BlogSpot
AWS Tutorial For Beginners | AWS Tutorial with AWS Training Videos
Thanks for such a great article here. I was searching for something like this for quite a long time and at last I’ve found it on your blog. It was definitely interesting for me to read about their market situation nowadays.
ReplyDeleteAWS Training in Bangalore
AWS training in sholinganallur
AWS training in Tambaram
AWS training in Velachery
Hi, thanks for your blog, if you want to learn about programming languages like java, php, android app, embedded system etc. I think this training institute is the best one.
ReplyDeleteBest java training in coimbatore
Android training in coimbatore
Networking training in coimbatore
hbar coin hangi borsada
ReplyDeletebtcst coin hangi borsada
vet coin hangi borsada
via coin hangi borsada
tron hangi borsada
juventus coin hangi borsada
beta coin hangi borsada
auto coin hangi borsada
mtl coin hangi borsada,
The world's leading casino | Woorica Casinos
ReplyDeleteIf you 블랙 잭 무기 live in the United 슬롯머신 무료 States, you should know that the vast majority 실시간 바카라사이트 of the 포커 페이스 뜻 land based casinos melbet in the US do not have land based casinos in the
SMM PANEL
ReplyDeletesmm panel
iş ilanları
İnstagram Takipçi Satın Al
hirdavatciburada.com
www.beyazesyateknikservisi.com.tr
servis
Tiktok jeton hilesi indir
üsküdar lg klima servisi
ReplyDeleteüsküdar daikin klima servisi
tuzla lg klima servisi
tuzla alarko carrier klima servisi
tuzla daikin klima servisi
çekmeköy toshiba klima servisi
ataşehir toshiba klima servisi
çekmeköy beko klima servisi
ataşehir beko klima servisi
Thank you for sharing! We appreciate your kind words. We're here to provide valuable information and insights, and we'll continue to do our best to keep you informed and engaged with excellent content. If you have more questions or need assistance with anything else, feel free to ask. Your feedback is invaluable.
ReplyDeletevisit: Using SQL for Data Analysis: Querying and Manipulating Databases
I like your all post. You have done really good work. Thank you for the information.If you want to know about anything you can visit: UNDERSTANDING THE IMPORTANCE OF SUPPLY CHAIN OPTIMIZATION
ReplyDeletegreat post, impressive , the way you explain java is hats off , no doubt getting high demands in IT is java , and your looking for it then visit java course in pune , thanks for this valuable post
ReplyDeletePower bi training in Chennai
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDelete