Gray-haired and camera-equipped, veterans of the Imperial Japanese Armed Forces alight from tour buses at Yasukuni Shrine in central Tokyo almost every day. They look like ordinary tourists, but they have come to discharge a solemn responsibility, commemoration of the souls of friends killed in battle.

Inside, inscribed on carefully guarded sheets of paper, are the names of 2,464,151 Japanese soldiers and civilians formally recognized as having died in service to their country, most of them between 1941 and 1945. Their souls are believed to inhabit the shrine.

Visitors bow, clap their hands to announce their presence and silently pray. Afterward, some wander through the shrine's museum, where relics of Japan's days as a great military power are on display. There is a mint-condition kamikaze plane, the blood-stained tunic of ageneral who committed ritual suicide, a tank destroyed in the battle or Saipan island.

"Times have changed so drastically," observed Taiji Yamauchi, a retired art dealer, as he gazed at a case full of imperial uniforms. "Young people had to go to war and die in those days, and it was considered an honor."

Forty years after the end of World War II, the 48 million Japanese lucky enough to have survived it continue to honor their dead and sort out their feelings about the great conflict, which brought the first total defeat in Japanese history.

But their generation is fast giving way to one that knows little of the struggle and is not eager to learn. Seventy-two million of the 120 million people living in Japan today were born after the war, and their elders complain they judge life too much by their salaries or rung on the company ladder.

They all live in a country that was altered profoundly by the war and the six-year U.S. occupation that followed. Enduring effects of these two periods range from an addiction to instant coffee to new attitudes toward work and material wealth and extreme sensitivity to any increase in military spending. To this day, any step toward raising the defense budget brings on a shower of allegations from opposition politicians that new militarism could be just around the corner.

Americans have difficulty grasping the scope of the losses this country suffered.

In addition to the 2.5 million war dead, close to 500,000 civilians died in air raids. One in four houses in Japan was destroyed. More than 60 square miles in five great cities were reduced to ash and twisted metal.

The war lasted four years for Americans. For Japanese, it went on for 14, starting from the time their troops marched into Manchuria in 1931.

If not death, people faced horrible privation.

"We got so hungry that I cooked the roots of vegetables. It damaged the stomachs of all my children," said Tora Awazu, 83, a Tokyo woman. Parents walked miles to factories to put in 12-hour work days. Children shivered at their school desks after donating classroom stoves for scrap metal.

"There was no path open for me but to be a soldier and fight for the country," recalled Minoru Inoue, a 62-year-old farmer who spent two years in China as an enlisted man. "All of society was one color then, the color of war."

The war was in vain, but it bred intense strength and hatred of poverty in that generation. Today, that is often cited in Japan's rise to undreamed-of prosperity in the ensuing years.

"They lost the war," said Takehide Yokoo of the National Institute for Educational Research. "But then they gave their all again for the economic battle."

There was virtually no dissent in wartime Japan. But after the shock of surrender, millions of people began questioning how and why the fighting had started. Many blamed militarism and ultranationalism and turned their backs on all forms of violence.

Postwar Japan was once described as "100 million people united in repentance." That was incorporated into the "peace constitution" after the war and remains the official view. Japanese leaders have repeated it countless times in speeches in countries that Japan occupied or fought during the war.

"The life was hard, terrible," said Inoue. "I can only say that we should never go to war again."

But some social commentators say that as time passes, memories of why the war began dim. Instead, Japan is seen increasingly by the war generation as a great sufferer, a star-crossed victim of modern-day cruelty, the country of the atomic bomb.

Yet some Japanese today seem to see the war as wrong mainly because it could not be won. By a few, it is remembered as a glorious but vain struggle for nation and emperor, a time when bright-eyed cadets departed for war ready to die, saying, "Let us meet again beneath the cherry trees of Yasukuni."

Said Toshiro Takahashi, a former Imperial Army captain who is now director of Kaikoshya, a veterans association: "In some ways, I feel my real life lasted only until the end of the war."

Occasionally, such feelings surface in public, to Japan's chagrin. Earlier this year, the Japanese head of the newly formed Japan-China Society for Exchange of Technical Personnel was quoted as saying the group should embrace the ideal of "Harmony of the Five Races" of Asia, a slogan Japan fostered as it was also setting up its puppet state in Manchuria in the 1930s.

At the same time, Japanese historians have felt free to begin a reappraisal. Many contend that conventional accounts of the war are the victor's and therefore tainted. They cite a "Tokyo trial slant" on today's views, a reference to the Allied-run war crimes tribunal that in 1948 sentenced seven Japanese leaders to death, 18 to prison terms and formally stamped the country as an aggressor.

Some scholars are depicting Japan in the prewar days as a dynamic nation emerging in a region where the western powers were grabbing territory right and left. The war did lead to great cruelty, they concede, but by and large Japan's actions were forced on it by the West.

"It was necessary to wage war to preserve our identity," writes Saitama University associate professor Michiko Hasegawa in a recent essay. She noted that whatever the negative effects, the war did bring about Asia's permanent liberation from western colonialism.

It is unclear how deep such thinking runs in the corporate and political elite that runs Japan today. But many members were junior officers during the war. Prime Minister Yasuhiro Nakasone held a commission in the Imperial Navy and early in his career campaigned against the constitution's no-war provision.

Since taking office, he has courted controversy by repeatedly visiting Yasukuni, challenging postwar rules on separation of church and state. His actions are applauded by large numbers of people who believe devoutly that the souls there will not rest in peace until Japan as a nation honors them.

Critics saw the hand of the old guard three years ago, when it was reported that the Ministry of Education rewrote some school textbooks to soften history's judgement of Japan. Among other things, its "invasion" of China was to be changed to an "advance." China and other foreign countries cried foul, and the books were changed back.

The government is also continuing a major arms buildup aimed at letting Japan take a bigger role in regional security, in partnership with the United States. But antiwar sentiments make it a fight at every step of the way and have helped keep military spending down to 1 percent of the gross national product.

Japan periodically debates without conclusion whether measures imposed during the 1945-51 occupation, in particular the constitution's no-war clause, fit the country's needs today. But many other major measures are never questioned, such as women's suffrage, labor's right to organize and firm civilian control of government.

It is unlikely that the Japanese will ever purge cultural baggage that American GIs brought with them starting in 1945. Coca-Cola, instant coffee and western-style beds, which today are household necessities for millions of Japanese, made their first appearance in force at that time.

Young people today are ignorant about the war and its aftermath partly because of deliberate policies of the past 40 years. The occupation authorities briefly banned the teaching of Japanese history in an attempt to curb nationalism. Today, the war still gets only scant treatment.

Nobuyoshi Miyahara, a 21-year-old student at a Tokyo accounting school, lost a relative to the war, but he can not say who. He only knows that on a Buddhist shrine in the old family home north of Tokyo, there was a yellowed picture of a man in uniform.

"The Pearl Harbor attack was World War II, right?" he asks during a conversation at a Tokyo fast-food outlet. Miyahara is a bit embarrassed. He would like to learn more, he explained, but "I'm very busy with my accounting studies. Enrolling in a course like this requires a big commitment."

Relics at the Yasukuni museum dumbfound visiting students, who rarely face danger worse than a tangle with the school bully. A young man who was studying a human torpedo, the underwater counterpart of a kamikaze plane, could only mutter "difficult, difficult to say," when asked for his impressions.

What young adults display toward things military today is more apathy than hatred. Japanese boys love toy guns and cartoon violence as much as Americans, but on growing up, almost no one considers going into the armed forces.

A military tradition endures in some families of rural and small-town Japan, however. They provide sons (and a few daughters) to recruiters, who also draw on the bored and maladapted of society to fill the quotas.

Most recruits today have high school diplomas or better, making Japan's armed forces among the world's best educated. But the great majority of the 1 million high school and university graduates who enter the job market here each year never consider the military option. In mainstream Japan, success is pursued in corporate and government offices.

War movies here normally carry an antiwar theme but still do poorly at the box office. The Toho Film Co. released "Zero Fighter Aflame" last year, depicting tragic heroism among the young men flying the famous plane. It flopped.

"We have no more war pictures planned for the present," said company president Tomoyuki Tanaka.

Older people will always care, however. Earlier this year, newspapers and television gave heavy coverage to a poignant group of "orphans" visiting Japan. These orphans, now middle-aged, live in China, were raised as Chinese and do not speak Japanese. They are the sons and daughters of Japanese who had left China in a hurry in the war era, leaving their children behind in the chaos.

Veterans continue to visit Pacific islands and Southeast Asian countries, both to relive old battles and search for bones and other relics of missing men. Major finds are common. In the year ending March 31, 182 sets of bones were found by government teams on Iwo Jima and 325 on Okinawa.

Japanese troops fought the British, the Dutch, the Chinese and, at the very end, the Soviets during World War II. But the foe is overwhelmingly remembered here as American. The occupation was in theory a joint Allied undertaking, but ordinary Japanese saw only GIs on the street.

In places, there is lingering bitterness toward the United States for the war. In July, for instance, the Nagasaki city government discouraged an American who had flown aboard the B29 that dropped the atomic bomb on that city from attending anniversary memorial services Aug. 9. It might not be possible to guarantee his safety, officials said.

But one must look hard to find cases like that. To the extent that this insular society can open its doors to any outsiders, it has done so to Americans. Public opinon polls consistently find that the Japanese consider the United States to be their best friend in the world. Even news such as recent disclosure that American strategists considered dropping an atomic bomb on the Imperial Palace in Tokyo is reported matter-of-factly in the press.

With the 40th anniversary drawing near, neither government has felt compelled to seek a Bitburg-type ceremony for a final interment of old emnities. That is accomplished already, in Japanese eyes. It can be seen at the memorial in Pearl Harbor to the U.S. battleship Arizona, sunk in the Japanese attack on Dec. 7, 1941. Today it is a favorite spot for Japanese tourists. The U.S. Park Service, recognizing the times, welcomes them and makes recorded announcements in Japanese.