Coder Baba
2.42K subscribers
1.01K photos
23 videos
722 files
723 links
Everything about programming for beginners.
1 and only official telegram channel of CODERBABA India.

Content:
.NET Developer,
Programming (ASP. NET, VB. NET, C#, SQL Server),
& Projects
follow me https://linktr.ee/coderbaba
*Programming
*Coding
*Note
Download Telegram
Java Programming PROBLEM:

DIFFERENT DATATYPES
Write a program to ask the user to enter an int, float, char, string, long and boolean data type values and to print its value.


Input and Output Format:

Refer Sample Input and Output for formatting specifications.


Sample Input and Output:

[All text in bold corresponds to input and the rest corresponds to output]

Hint:

Use String format() method or Math.round() method - for all floating point values displayed correct to 2 decimal place.


Enter integer

56

Enter float

56.65

Enter character

A

Enter string

Java

Enter long

12345678910

Enter boolean

true

56 is an integer value

56.65 is a float value

A is a character value

Java is a string value

12345678910 is a long value

true is a boolean value
TempData Vs Session in ASP .NET MVC:

πŸ‘‰πŸ»TempData

βœ…TempData allow us to persisting data for the duration of single subsequent request.
βœ…ASP. net MVC will automatically expire the value of tempdata once consecutive request returned the result (it means, it alive only till the target view is fully loaded).
βœ…It valid for only current and subsequent request only
βœ…TempData has Keep method to retention the value of TempData.

Example:

TempData.Keep(), TempData.Keep(β€œEmpName”)

βœ…TempData internally stored the value in to Session variable.

βœ…It is used to stored only one time messages like validation messages, error messages etc.

πŸ‘‰πŸ»Session:

⚑️Session is able to store data much more long time, until user session is not expire.
⚑️Session will be expire after the session time out occurred.
⚑️It valid for all requests.
⚑️N/A
⚑️Session variable are stored in SessionStateItemCollection object (Which is exposed through the HttpContext.Session property of page).
⚑️It is used to stored long life data like user id, role id etc. which required throughout user session.
⚑️TempData and session, both required typecasting for getting data and check for null values to avoid run time exception.