7.-Casting.txt

7.-Casting.txt - Type Casting Assigning a value of one type...

  • No School
  • AA 1
  • 1

This preview shows page 1 out of 1 page.

Type Casting Assigning a value of one type to a variable of another type is known as Type Casting. To cast a value to a specific type, place the type in parentheses and position it in front of the value. Example: int a = (int) 3.14; System.out.println(a); //Outputs 3 The code above is casting the value 3.14 to an integer, with 3 as the resulting
Image of page 1
  • Fall '19
  • type casting

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern