Oop Group Assignment - 120021
Oop Group Assignment - 120021
PROGRAMME : ODCS
(a) The history of java programming language is a story of innovation and adaptation, evolving
from a project aimed at consumer electronics to becoming a cornerstone of modern software
development. However, it is accurate to say that java’s design was significantly influenced by C
and also C++. Discuss the relationship between C and Java.
The relationship between the C programming language and Java is foundational, as Java was
designed with significant inspiration from C, sharing its syntax and various programming
paradigms while aiming to improve upon areas where C fell short. Here are key aspects of their
relationship:
➢ Platform Independence:
One of Java's primary goals was to achieve platform independence via its "write once,
run anywhere" philosophy. WHILE C is compiled to machine code for specific
platforms, Java code is compiled into bytecode that runs on the Java Virtual Machine
(JVM). This approach allows Java applications to run on any platform that has a
compatible JVM, a significant advancement over C's native execution model.
➢ Security Features:
Java places a strong emphasis on security, particularly with its use of the Java Virtual
Machine (JVM). The sandbox model allows for running applications in a controlled
environment, which can restrict capabilities like file access and network
communications. WHILE C does not inherently include such security measures, Java's
design reflects the changing landscape of software development, where security is a
critical concern.
➢ Standard Libraries:
Java comes with an extensive standard library (Java API) that provides built-in classes
and methods for a wide range of functionalities, promoting rapid development and
reducing the need for third-party libraries. WHILE C has standard libraries, they are
generally less extensive and often require additional libraries for object-oriented
functionalities.
➢ Memory Management:
C requires manual memory management through pointers and allocation functions (like
`malloc` and `free`), which can lead to complex bugs such as memory leaks and pointer
errors. Java, on the other hand, introduced automatic garbage collection to simplify
memory management and reduce the likelihood of such bugs. This design choice was
influenced by the recognition of these complexities in C.
Conclusion:
In summary, Java can be seen as a refinement and evolution of the ideas present in C,
incorporating the strengths of C while addressing its weaknesses. The influence of C and C++ is
significant, particularly in terms of syntax and the inclusion of OOP concepts. Java's design
choices reflect the needs of modern software development, emphasizing safety, portability, and
ease of use, resulting in its widespread adoption for a variety of applications, from web
development to enterprise software.
➢ Versatility.
Java can be used to develop a wide range of applications, from web applications and
mobile apps to large-scale enterprise systems, embedded systems, and scientific
applications. Its flexibility allows developers to work in numerous domains and
industries.
➢ Platform Independence.
One of Java's core principles is the "write once, run anywhere" (WORA) philosophy.
Java programs are compiled into bytecode, which can be executed on any platform that
has a Java Virtual Machine (JVM). This platform independence makes it suitable for a
variety of operating systems, such as Windows, macOS, and Linux.
➢ Object-Oriented Structure
Java includes several features that enhance its robustness and security, such as strong
type checking, automatic garbage collection, and exception handling. This makes it
suitable for developing reliable applications in various environments.
➢ Scalability
Java is designed to build scalable applications that can handle increased loads efficiently.
Its concurrency features and performance optimizations make it an ideal choice for
enterprise-level solutions.
QUESTION TWO
Use Table 1 which shows numerical score ranges and their respective grades to write a Java
application that checks the student’s score and prints the student’s grade in a web browser.
Answer
II Handle invalid input
system.out.println("Invalid input. Please enter a valid integer score.");
} finally {
II Close the scanner to avoid memory Leaks
scanner.close();
}
}
}
REFERENCES
Binstock, Andrew (May 20, 2015). "Java's 20 Years of Innovation". Forbes. Archived from the
original on March 14, 2016. Retrieved March 18, 2016.
Barbara Liskov with John Guttag (2000). Program Development in Java – Abstraction,
Specification, and Object-Oriented Design. USA, Addison Wesley. ISBN 978-0-201-65768-5.
Chaudhary, Harry H. (July 28, 2014). "Cracking The Java Programming Interview: 2000+ Java
Interview Que/Ans". Archived from the original on September 29, 2023. Retrieved May 29,
2016.
Java 5.0 added several new language features (the enhanced for loop, autoboxing, varargs and
annotations), after they were introduced in the similar (and competing) C# language. Archived
March 19, 2011, at the Wayback Machine Archived January 7, 2006, at the Wayback Machine