intro to programming study guide.docx

Full Transcript

What is the difference between OOP and Procedural Programming in java. Procedural Programming: focusing on functions and actions. Object-Oriented Programming: focusing on the objects themselves and how they can do things together. Explain the purpose of a program in java? A program in Java is a...

What is the difference between OOP and Procedural Programming in java. Procedural Programming: focusing on functions and actions. Object-Oriented Programming: focusing on the objects themselves and how they can do things together. Explain the purpose of a program in java? A program in Java is a way to tell the computer how to do something. What is an identifier kids explanation identifiers are used to name things like variables, functions, or files so that the computer can keep track of them easily. What are the rules to form a valid identifier? 1\. Characters Allowed:. Identifiers must begin with a letter (a-z, A-Z) or an underscore (\_). Subsequent characters can include letters, digits (0-9), or underscores.. Case Sensitivity.Reserved Keywords. No special Characters. No Leading Numbers Examples of valid. testvariable. a. name1 Examples of invalid identifiers. test variable (no space allowed). 123javatpoint( should not begin with numbers). a-javatpoint(hyphen is not allowed). java\_&-Tpoint(the and symbol is not allowed) What's the purpose of white space and indentation?. makes your code neat and easy to understand. why do we need comments in java kids explanation. makes code easy to read. helps remember things. communicate with others. organizing thoughts. Debugging. how many class declaration do we have. main classes: It usually contains the main method, which is where the program begins to run. user-defined classes: Represents specific things, like a \"Car\" or \"Dog.\" They can have their own properties (variables) and actions (methods). abstract classes: helps organize and share common ideas, but you need to make specific classes to create real objects that can be used. interfaces classes: set of rules that different classes can follow to make sure they can do certain things. nested classes: These are classes defined within another class. They can help organize code better and can access the outer class\'s members. Java Source Code: Special language that humans can read and understand Java Interpreter: Translates instructions written in Java into something the computer can understand and do. High level Language: makes it easier for people to talk to computers without getting too technical. -Differentiate between Syntax and Semantics in Java programming Syntax: rules of grammar in a language. Semantics: The meaning of the code. \- Explain compile-time errors, run-time errors and logical errors. Compile-time Errors: Problems before running the program. Run-time Errors: Problems that happen while running the program. Logical Errors: Problems where the program runs fine, but the answer is wrong. What are the three types of output statements in java:. print(): Keeps everything on the same line.. println(): Starts a new line after printing.. printf(): Gives you control over how the output looks. What is a scanner class:.Scanner is like a helper that reads information..You can use it to get input from users or files. Explain conditional statements allow a program to make decisions based on certain conditions. What are loops:.set of instructions that repeat a specific number of times or until a certain condition is met. What are the three types of output statements in java?. System.out.print(): Displays text without moving to a new line..System.out.println(): Displays text and moves to the next line..System.out.printf(): Displays formatted text, allowing for more control over how it looks.

Use Quizgecko on...
Browser
Browser