1,357
12
Essay, 2 pages (350 words)

Variables, expressions, and data types

Variables Expressions and Data Types Programming and mathematics share the use of logic and development of algorithms to solve or complete a certain action or solve a problem. Applying mathematics in the program can be done through use of mathematical functions and algorithms like sorting, searching, use of induction in recursive algorithms and lambda calculus. Sorting algorithms are used in sorting arrays in an application or organizing names, and this makes searching for these values easier in a program. Mathematical sort algorithms are used to sort different data types, files or even URL.
Variables in applications are names that provide a program with a named storage that allows programs to manipulate them. Variables have specific types, and this determines the layout of the variable memory and its size. Variables can be local variables, instance variables and static/class variables. Local variables are declared in constructors, blocks or methods and are created once they enter these methods, constructors and blocks. Local variables are destroyed when they exit constructors, blocks or methods. Instance variables are declared in classes but outside of any blocks. Static variables are declared in classes like instance variables but with the keyword static. They are created when a program starts and destroyed when the program exits.
An expression in a program is a collection of variables, operators, constants, values and programming functions that will be interpreted according to rules of the associations that are specific to different programming languages. Expressions are computed to produce results to be stored in a variable.
Data types define the kind of values that a variable can store. The values stored can be integers, characters or strings. Data types in programming include primitive and reference data types. Primitive data types are those that have been predefined by a programming language and are named by a keyword. They include byte, short, integer, long, float, double, Boolean and char. Reference data types are created using defined constructors of a class. Reference variables are declared to a specific type and used in accessing objects. Default values of reference variables are always a null value.
Works Cited
Deitel Harvey, D. Paul. (2012). Java, How To Program. (9th ed)Prentice Hall.
Rosen, K. H. (1998). Discrete Mathematics and its Applications (Vol. 2nd ). Boston: Pearson EducationInc.
Wayne, B. R. (2011). Algorithms (Vol. 4th ed). Washington D. C: Pearson Education Inc.

Thank's for Your Vote!
Variables, expressions, and data types. Page 1
Variables, expressions, and data types. Page 2
Variables, expressions, and data types. Page 3

This work, titled "Variables, expressions, and data types" was written and willingly shared by a fellow student. This sample can be utilized as a research and reference resource to aid in the writing of your own work. Any use of the work that does not include an appropriate citation is banned.

If you are the owner of this work and don’t want it to be published on AssignBuster, request its removal.

Request Removal
Cite this Essay

References

AssignBuster. (2021) 'Variables, expressions, and data types'. 16 November.

Reference

AssignBuster. (2021, November 16). Variables, expressions, and data types. Retrieved from https://assignbuster.com/variables-expressions-and-data-types/

References

AssignBuster. 2021. "Variables, expressions, and data types." November 16, 2021. https://assignbuster.com/variables-expressions-and-data-types/.

1. AssignBuster. "Variables, expressions, and data types." November 16, 2021. https://assignbuster.com/variables-expressions-and-data-types/.


Bibliography


AssignBuster. "Variables, expressions, and data types." November 16, 2021. https://assignbuster.com/variables-expressions-and-data-types/.

Work Cited

"Variables, expressions, and data types." AssignBuster, 16 Nov. 2021, assignbuster.com/variables-expressions-and-data-types/.

Get in Touch

Please, let us know if you have any ideas on improving Variables, expressions, and data types, or our service. We will be happy to hear what you think: [email protected]